-
Notifications
You must be signed in to change notification settings - Fork 397
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
[GLUTEN-4772][VL] Support empty map/array literal #4771
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 |
it seems the CH backend failed test is related.
|
literalBuilder.setList(listBuilder.build()); | ||
} else { | ||
Type.List.Builder listTypeBuilder = Type.List.newBuilder(); | ||
listTypeBuilder.setType(elementType.toProtobuf()); |
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.
if if element type is NullType, we will still fallback it right ? e.g., select array();
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.
It's related to #2996. It will not fallback once NullType is supported
@@ -382,7 +393,8 @@ std::shared_ptr<const core::ConstantTypedExpr> SubstraitVeloxExprConverter::toVe | |||
ArrayVectorPtr SubstraitVeloxExprConverter::literalsToArrayVector(const ::substrait::Expression::Literal& literal) { | |||
auto childSize = literal.list().values().size(); | |||
if (childSize == 0) { | |||
return makeEmptyArrayVector(pool_); | |||
// childSize == 0 should not happend here but just for integrity check | |||
return makeEmptyArrayVector(pool_, UNKNOWN()); |
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.
Maybe it's better to throw for unexpected behavior.
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.
+1, if the child size is 0 that means it is a empty list, we should not go into this method. @WangGuangxin can you address this comment ?
@@ -393,7 +405,8 @@ ArrayVectorPtr SubstraitVeloxExprConverter::literalsToArrayVector(const ::substr | |||
MapVectorPtr SubstraitVeloxExprConverter::literalsToMapVector(const ::substrait::Expression::Literal& literal) { | |||
auto childSize = literal.map().key_values().size(); | |||
if (childSize == 0) { | |||
return makeEmptyMapVector(pool_); | |||
// childSize == 0 should not happend here but just for integrity check | |||
return makeEmptyMapVector(pool_, UNKNOWN(), UNKNOWN()); |
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.
Same.
@@ -497,6 +510,7 @@ RowVectorPtr SubstraitVeloxExprConverter::literalsToRowVector(const ::substrait: | |||
vectors.emplace_back(literalsToMapVector(child)); | |||
break; | |||
} | |||
|
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: remove this empty line?
Run Gluten Clickhouse CI |
1 similar comment
Run Gluten Clickhouse CI |
cb8a1cb
to
512767f
Compare
Run Gluten Clickhouse CI |
@WangGuangxin can you take a look at ch backend test ? it seems still failed |
@ulysses-you sure. you mean this one ? I cannot login it since it requires username and password. Can you paste the failed Test? |
@WangGuangxin there is a public read-only account |
Run Gluten Clickhouse CI |
d258684
to
5b83029
Compare
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
It's ok now, cc @ulysses-you @rui-mo |
validateFallbackResult("SELECT array(map())") | ||
validateFallbackResult("SELECT map()") | ||
validateFallbackResult("SELECT map(1, array())") | ||
validateFallbackResult("SELECT map(1, map())") | ||
validateFallbackResult("SELECT array(null)") |
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.
Do you know why does it fallback ?
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's not related to empty literal, but NullType support.
I'll fix it in another PR, otherwise this PR is too big.
@WangGuangxin can you resolve this comment ? #4771 (comment) |
ok |
CC: @PHILO-HE |
Run Gluten Clickhouse CI |
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.
If CI passes.
There is a failed test |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
Run Gluten Clickhouse CI |
issues resolved @ulysses-you @rui-mo |
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.
Thanks!
===== Performance report for TPCH SF2000 with Velox backend, for reference only ====
|
What changes were proposed in this pull request?
Support array or map literal without value.
For example
How was this patch tested?
Added UT