xiangfu0 commented on code in PR #10254: URL: https://github.com/apache/pinot/pull/10254#discussion_r1107676266
########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java: ########## @@ -703,6 +705,49 @@ private BrokerResponseNative handleRequest(long requestId, String query, } } + private void handleBigInClause(PinotQuery serverPinotQuery) { + int inPredicateSortThreshold = Integer.parseInt(serverPinotQuery.getQueryOptions() + .getOrDefault(Broker.Request.QueryOptionKey.IN_PREDICATE_SORT_THRESHOLD, + Broker.Request.QueryOptionValue.DEFAULT_IN_PREDICATE_SORT_THRESHOLD)); + String rawTableName = TableNameBuilder.extractRawTableName(serverPinotQuery.getDataSource().getTableName()); + if (serverPinotQuery.getFilterExpression() != null) { + handleBigInClause(rawTableName, serverPinotQuery.getFilterExpression(), inPredicateSortThreshold); + } + if (serverPinotQuery.getHavingExpression() != null) { + handleBigInClause(rawTableName, serverPinotQuery.getHavingExpression(), inPredicateSortThreshold); + } + } + + private void handleBigInClause(String rawTableName, Expression expression, int inPredicateSortThreshold) { + if (expression.getType() == ExpressionType.FUNCTION) { + Function functionCall = expression.getFunctionCall(); + + switch (functionCall.getOperator()) { + case "IN": + case "NOT_IN": + List<Expression> operands = functionCall.getOperands(); + if (operands.size() > inPredicateSortThreshold && isExpressionStringColumn(operands.get(0), rawTableName)) { + Collections.sort(operands.subList(1, operands.size())); Review Comment: Removed broker side sort, only do it on server side. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org