kishoreg 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_r292963824
##########
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:
This existed in the current code as well, I dont think its possible for
getChildren() to be null, this AstNode should not get invoked if its null I
think. I am trying to keep it bug to bug/feature to feature compatible with
existing code without changing the behavior. This is the only way for me to
ensure parity across the two. Our eventual goal is to completely get rid of
this parsing layer. Let's not invest too much time in cleaning this up now.
----------------------------------------------------------------
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]