Jackie-Jiang commented on a change in pull request #4216: PQL -> SQL
enhancement - phase 1 - new Pinot Query Struct
URL: https://github.com/apache/incubator-pinot/pull/4216#discussion_r292689276
##########
File path:
pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java
##########
@@ -155,6 +157,74 @@ public FilterQueryTree buildFilterQueryTree() {
}
}
+ @Override
+ public Expression buildFilterExpression() {
+ if (_identifier == null) {
+ throw new Pql2CompilationException("Comparison predicate has no
identifier");
+ }
+
+ if ("=".equals(_operand)) {
+ if (_identifier != null && _literal != null) {
+ Expression expr =
RequestUtils.createFunctionExpression(FilterKind.EQUALS.name());
+
expr.getFunctionCall().addToOperands(RequestUtils.createIdentifierExpression(_identifier));
+
expr.getFunctionCall().addToOperands(RequestUtils.createLiteralExpression(_literal));
+ return expr;
+ } else {
+ throw new Pql2CompilationException("Comparison is not between a column
and a constant");
+ }
+ } else if ("<>".equals(_operand) || "!=".equals(_operand)) {
+ if (_identifier != null && _literal != null) {
+ Expression expr =
RequestUtils.createFunctionExpression(FilterKind.NOT_EQUALS.name());
+
expr.getFunctionCall().addToOperands(RequestUtils.createIdentifierExpression(_identifier));
+
expr.getFunctionCall().addToOperands(RequestUtils.createLiteralExpression(_literal));
+ return expr;
+ } else {
+ throw new Pql2CompilationException("Comparison is not between a column
and a constant");
+ }
+ } else {
+ if (_identifier != null) {
+ boolean identifierIsOnLeft = true;
Review comment:
We add support to `1 < column`? Do we support this right now?
Also, how about function in comparison?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]