-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add all supported types to return type inference from string literal for JSON extract functions in the multi-stage query engine #14289
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
Add all supported types to return type inference from string literal for JSON extract functions in the multi-stage query engine #14289
Conversation
…for JSON extract functions in the multi-stage query engine
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14289 +/- ##
============================================
+ Coverage 61.75% 63.77% +2.02%
- Complexity 207 1556 +1349
============================================
Files 2436 2660 +224
Lines 133233 145837 +12604
Branches 20636 22313 +1677
============================================
+ Hits 82274 93012 +10738
- Misses 44911 45961 +1050
- Partials 6048 6864 +816
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| } | ||
|
|
||
| private static RelDataType inferTypeFromStringLiteral(String operandTypeStr, RelDataTypeFactory typeFactory) { | ||
| switch (operandTypeStr) { |
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.
Shouldn't the list also contain:
- BOOLEAN
- TIMESTAMP
- FLOAT
- DOUBLE
?
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.
Those are handled in the default branch.
| "SELECT /*+ aggOptions(is_skip_leaf_stage_group_by='true') */ a.col2, a.col3 FROM a JOIN b " | ||
| + "ON a.col1 = b.col1 WHERE a.col3 >= 0 GROUP BY a.col2, a.col3" | ||
| }, | ||
| new Object[]{"SELECT ROUND(ts_timestamp, 10000) FROM a"} |
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.
I think it'd be good add tests for other result types.
Jackie-Jiang
left a comment
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.
Good catch!
In Calcite, FLOAT is a synonym for DOUBLE (see here), and we'll need to map FLOAT in pinot to REAL.
Suggest adding a test to verify all supported types
Ah yeah, I did do this for
I've added test cases for all supported types (from here) to |
SELECT JSON_EXTRACT_SCALAR(payload_commits, '$[*].author.name', 'STRING_ARRAY') FROM github_eventsfails on the multi-stage query engine with an error like:Invalid type: STRING_ARRAY.TransformFunctionTypedoesn't cover all the types supported byJSON_EXTRACT_SCALAR/JSON_EXTRACT_INDEX.pinot/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java
Lines 101 to 109 in 7879e07