Jackie-Jiang commented on code in PR #8518:
URL: https://github.com/apache/pinot/pull/8518#discussion_r853410387
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/PredicateComparisonRewriter.java:
##########
@@ -18,21 +18,27 @@
*/
package org.apache.pinot.sql.parsers.rewriter;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.commons.lang3.EnumUtils;
import org.apache.pinot.common.request.Expression;
+import org.apache.pinot.common.request.ExpressionType;
import org.apache.pinot.common.request.Function;
import org.apache.pinot.common.request.PinotQuery;
import org.apache.pinot.common.utils.request.RequestUtils;
import org.apache.pinot.pql.parsers.pql2.ast.FilterKind;
import org.apache.pinot.sql.parsers.SqlCompilationException;
-
public class PredicateComparisonRewriter implements QueryRewriter {
@Override
public PinotQuery rewrite(PinotQuery pinotQuery) {
Expression filterExpression = pinotQuery.getFilterExpression();
if (filterExpression != null) {
+ filterExpression = updateBooleanPredicates(filterExpression, null);
Review Comment:
The expression within the WHERE and HAVING clause should be of boolean type,
and `sum(field) > 10` will return a boolean result. Some functions can also
return boolean result, and is not captured as `FilterKind`, e.g.
`isWholeNumber(sum(field))`. For the HAVING clause, the aggregation result is
treated as a regular column, so we should handle it the same as WHERE clause.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]