-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[fix](variant) Recognize nullable array elements as NestedGroup types #66196
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3610,6 +3610,14 @@ TEST_F(ColumnVariantTest, subcolumn_finalize_and_insert) { | |
| array_subcolumn.finalize(); | ||
| } | ||
|
|
||
| TEST(ColumnVariantNestedGroupTypeTest, nullable_array_element_is_recognized) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Please exercise the conflict-policy behavior, not only the helper. The reported regression is that this predicate used to bypass |
||
| EXPECT_TRUE(is_nested_group_type(ColumnVariant::NESTED_TYPE)); | ||
|
|
||
| auto variant = std::make_shared<DataTypeVariant>(0, false); | ||
| EXPECT_TRUE(is_nested_group_type(variant)); | ||
| EXPECT_FALSE(is_nested_group_type(make_nullable(variant))); | ||
| } | ||
|
|
||
| TEST_F(ColumnVariantTest, deserialize_mixed_array_elements) { | ||
| ColumnVariant::Subcolumn subcolumn(0, true /* is_nullable */, false /* is_root */); | ||
|
|
||
|
|
||
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.
[P1] Preserve regular-array rows when the NG type becomes the LCT. If the destination already contains a mixed
Array<Jsonb>and the source isNESTED_TYPE, this newly true result makesresolve_ng_type_conflict()select the NG type and leave the old array part in place;Subcolumn::finalize()then sees an NG/non-NG mismatch and inserts defaults for every old row. Reversing the inputs instead reaches the same-dimensional array cast at lines 392-424 and preserves the values, so hierarchical/materialized merges become order-dependent. Distinguish genuine scalar conflicts from regular arrays during resolution/finalization, and cover both input orders.