Skip to content
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

Assign default value to newly added derived column upon reload #12648

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

shounakmk219
Copy link
Collaborator

This change is intended to handle the case where the derived column depends on upstream data which is not a column in the table schema. Currently it fails reloading the existing segments as existing segments don’t have this data available. With this PR the newly added derived column will be assigned the default null value in such cases so that user is able to query the column across all segments.

This change is intended to handle the case where the derived column depends on upstream data which is not a column in the table schema
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 61.34%. Comparing base (59551e4) to head (2a8593b).
Report is 137 commits behind head on master.

Files Patch % Lines
...loader/defaultcolumn/BaseDefaultColumnHandler.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12648      +/-   ##
============================================
- Coverage     61.75%   61.34%   -0.41%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2452      +16     
  Lines        133233   133847     +614     
  Branches      20636    20765     +129     
============================================
- Hits          82274    82109     -165     
- Misses        44911    45577     +666     
- Partials       6048     6161     +113     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 <0.01% <0.00%> (-61.71%) ⬇️
java-21 61.34% <0.00%> (-0.28%) ⬇️
skip-bytebuffers-false 61.31% <0.00%> (-0.44%) ⬇️
skip-bytebuffers-true 61.31% <0.00%> (+33.58%) ⬆️
temurin 61.34% <0.00%> (-0.41%) ⬇️
unittests 61.34% <0.00%> (-0.41%) ⬇️
unittests1 46.20% <0.00%> (-0.69%) ⬇️
unittests2 27.75% <0.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// TODO: Support creation of derived columns from forward index disabled columns
if (!_segmentWriter.hasIndexFor(argument, StandardIndexes.forward())) {
// replace the transform function with the default value for the derived column
String expression = _schema.getFieldSpecFor(column).getDefaultNullValueString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply short circuit it by invoking createDefaultValueColumnV1Indices(column)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, much better. Thanks for pointing it out!
reverted the changes and did as you suggested.

@Jackie-Jiang Jackie-Jiang merged commit 1f668c7 into apache:master Mar 18, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants