-
Notifications
You must be signed in to change notification settings - Fork 370
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
[VL] Explode support Literal array and map #4019
Conversation
Thanks for opening a pull request! Could you open an issue for this pull request on Github Issues? https://github.com/oap-project/gluten/issues Then could you also rename commit message and pull request title in the following format?
See also: |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
@zhouyuan Could you help to review? |
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.
@liujiayi771 thanks for helping on this. Just not sure if the nested type is considered.
unnestNames.emplace_back(fmt::format("C{}", unnestIndex++)); | ||
} else { | ||
VELOX_FAIL( | ||
"Unexpected type of unnest variable. Expected ARRAY or MAP, but got {}.", variable->type()->toString()); |
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.
nit: can we also apply this check logic in native validation?
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 actually already limited in Spark's Explode, which only supports map and array types.
} | ||
runQueryAndCompare(""" | ||
|SELECT explode(map(1, 'a', 2, 'b')); | ||
|""".stripMargin) { |
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.
nit: can you please also add a test for nested array/map? I'm not sure if this would work.
e.g. array(map(1, "2"))
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.
Yes, it can be executed normally, and two nested test cases have been added.
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.
👍
===== Performance report for TPCH SF2000 with Velox backend, for reference only ====
|
What changes were proposed in this pull request?
After my tests, I have found that the Velox backend does support the explode function for Literal inputs of both array and map types. We can lift the restrictions on validation.
How was this patch tested?
Add a test case in
TestOperator
.