-
Notifications
You must be signed in to change notification settings - Fork 240
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
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.53% +1.40%
- Complexity 976 1295 +319
============================================
Files 119 147 +28
Lines 11743 13477 +1734
Branches 2251 2354 +103
============================================
+ Hits 6591 7754 +1163
- Misses 4012 4457 +445
- Partials 1140 1266 +126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
// can be tracked https://github.com/apache/datafusion-comet/issues/1937 | ||
// 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 |
@andygrove PTAL again. all tests passed including #2321 |
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. Thanks @comphead
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)