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_r292687943
##########
File path:
pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BetweenPredicateAstNode.java
##########
@@ -82,6 +85,32 @@ public FilterQueryTree buildFilterQueryTree() {
}
}
+ @Override
+ public Expression buildFilterExpression() {
+ if (_identifier == null) {
+ throw new Pql2CompilationException("Between predicate has no
identifier");
+ }
+ if (getChildren().size() == 2) {
+ try {
+ LiteralAstNode left = (LiteralAstNode) getChildren().get(0);
+ LiteralAstNode right = (LiteralAstNode) getChildren().get(1);
+
+ final Expression betweenExpr =
RequestUtils.getFunctionExpression(FilterKind.BETWEEN.name());
+ final Function rangeFuncCall = betweenExpr.getFunctionCall();
+
rangeFuncCall.addToOperands(RequestUtils.getIdentifierExpression(_identifier));
+ rangeFuncCall.addToOperands(RequestUtils.getLiteralExpression(left));
+ rangeFuncCall.addToOperands(RequestUtils.getLiteralExpression(right));
+ return betweenExpr;
+ } catch (ClassCastException e) {
+ throw new Pql2CompilationException(
Review comment:
If getChildren() is null (don't know if it's possible), we will get NPE on
line 93
----------------------------------------------------------------
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]