-
Notifications
You must be signed in to change notification settings - Fork 236
feat: Add nested Array literal support #2181
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2181 +/- ##
============================================
+ Coverage 56.12% 57.41% +1.28%
- Complexity 976 1296 +320
============================================
Files 119 147 +28
Lines 11743 13418 +1675
Branches 2251 2349 +98
============================================
+ Hits 6591 7704 +1113
- Misses 4012 4451 +439
- Partials 1140 1263 +123 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -761,8 +763,11 @@ object QueryPlanSerde extends Logging with CometExprShim { | |||
// now supports only Array of primitive | |||
(Seq(CometConf.SCAN_NATIVE_ICEBERG_COMPAT, CometConf.SCAN_NATIVE_DATAFUSION) | |||
.contains(CometConf.COMET_NATIVE_SCAN_IMPL.get()) && dataType |
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.
CometConf.COMET_NATIVE_SCAN_IMPL.get()
returns auto
by default, so this logic would not get triggered in the default case?
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.
Thats a good point, for auto is it a way to figure out current scan impl?
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 there is no way to know it in runtime, created PR #2295
""" | ||
|select 1 a | ||
|""".stripMargin, | ||
"select array(array(1, 2, null), array(), array(10), null) from tbl") |
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.
👍
Test failed because of #2321 |
Depends on #2286 |
Which issue does this PR close?
Closes #2157
.
Rationale for this change
What changes are included in this PR?
This update introduces support for nested ARRAY literals in the Comet query plan serialization logic. The changes include both code refactoring and enhanced test coverage.
Highlights
Nested ARRAY Literal Support:
The code now handles array literals containing other arrays (i.e., arrays of arrays), enabling use of multi-dimensional array literals in queries.
Refactored Serialization Logic:
Serialization of array literals (including primitive and nested arrays) is now handled by a new recursive helper function, makeListLiteral.
The logic for handling array types has been extracted from a large match-case block into this helper, improving maintainability and extensibility.
Improved Type Handling:
The logic now recognizes and correctly serializes arrays whose element type is itself an array.
Type checks and element conversions are clarified and improved.
Detailed Changes
Code (QueryPlanSerde.scala)