-
Notifications
You must be signed in to change notification settings - Fork 203
Create default values for union during copying / runtime #5772
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5772 +/- ##
==========================================
- Coverage 85.94% 85.94% -0.01%
==========================================
Files 1620 1620
Lines 73512 73510 -2
Branches 8788 8783 -5
==========================================
- Hits 63181 63179 -2
Misses 10107 10107
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmark ResultMaster commit hash:
Other queries
|
} else { | ||
childValue->setNull(false); | ||
childValue->copyFromRowLayout(unionValues); | ||
children[0] = std::make_unique<Value>(std::move(childValue)); |
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 am a bit confused there?
When will the children by empty? Since you always push a value to the createDefaultValue
function:
ase LogicalTypeID::UNION: {
// We can't create a default value for the union since the
// selected variant is runtime information. Default value
// is initialized when copying (see Value::copyFromUnion).
return Value(dataType.copy(), std::vector<std::unique_ptr<Value>>{});
In
Value::createDefaultValue
we were initializing a union value with a singlenull
value as the default child. This resulted in the child lacking required information when copying from certain types. For example,childrenSize
of the child would be0
, and so if the selected field turned out to be a struct (with more than one field), none of its fields would be copied, resulting in an empty output. E.g.when the correct output should be
{b: 2}
The solution implemented here was to just set up default union values with no children, and create the default child value during copying once we know the selected field.