-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[multistage] Evaluate literal expression during query parsing #11438
Conversation
8d0f568
to
b3b06f4
Compare
b3b06f4
to
2948236
Compare
Codecov Report
@@ Coverage Diff @@
## master #11438 +/- ##
============================================
- Coverage 63.04% 63.03% -0.02%
Complexity 1109 1109
============================================
Files 2320 2320
Lines 124477 124520 +43
Branches 19004 19011 +7
============================================
+ Hits 78477 78487 +10
- Misses 40417 40436 +19
- Partials 5583 5597 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
e56efba
to
2cdc4ba
Compare
a840b8a
to
75ff297
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not rely on type inference. Instead, we should use the standard bytes literal in SQL. Since this evaluator is on broker side, it shouldn't hit the limitation of v1 engine where bytes literal cannot be passed through thrift
pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
Outdated
Show resolved
Hide resolved
52a6817
to
d023fd8
Compare
1a527cd
to
a5e63e6
Compare
fecc836
to
e7b1090
Compare
pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
Show resolved
Hide resolved
...ntegration-tests/src/test/java/org/apache/pinot/integration/tests/custom/GeoSpatialTest.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
88586bf
to
c26e44e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
Outdated
Show resolved
Hide resolved
afbe77e
to
fa6330a
Compare
fa6330a
to
71440b5
Compare
@@ -204,6 +214,8 @@ private static Object constructLiteral(Plan.LiteralField literalField) { | |||
return literalField.getDoubleField(); | |||
case STRINGFIELD: | |||
return literalField.getStringField(); | |||
case BYTESFIELD: | |||
return literalField.getBytesField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should unwrap ByteString here
} else if (fieldObject instanceof GregorianCalendar) { | ||
builder.setLiteralField(longField(((GregorianCalendar) fieldObject).getTimeInMillis())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not use longField b/c we cannot differentiate whether it is a long or a Calendar object when DeSer
expression.getLiteral().setStringValue(BytesUtils.toHexString(value)); | ||
return expression; | ||
} | ||
|
||
public static Expression getLiteralExpression(ByteString value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not necessary once we fixed ProtoSerdeUtils
Use rule to evaluate and replace RexCall to RexLiteral in Project and Filter nodes.
The evaluation is recursive, so it will cover nested function calls as well.
Drawback: The FunctionInvoker is using v1 ScalarFunctions, so the data type output might be different than the RexNode type. In that case, we need to cast.