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

feat: Check flags field of ArrowSchema on ArrowSchemaViewInit #368

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

paleolimbot
Copy link
Member

Closes #312.

ArrowSchemaViewInit() is called every time a schema is about to be interpreted (or an array corresponding to that schema is about to be interpreted), and so checking the flags is a must to ensure some future unsupported flag that affects the interpretation of an array will cause an error.

The ArrowSchemaView should arguably also keep track of flags (or perhaps each flag individually), but I will leave that to another PR.

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5d56676) 87.92% compared to head (549bda2) 87.88%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
- Coverage   87.92%   87.88%   -0.04%     
==========================================
  Files          76       76              
  Lines       13353    13367      +14     
==========================================
+ Hits        11740    11748       +8     
- Misses       1613     1619       +6     

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

@paleolimbot paleolimbot marked this pull request as ready for review January 24, 2024 13:55
@paleolimbot paleolimbot requested a review from bkietz January 24, 2024 13:57
@danepitkin
Copy link
Member

Overall LGTM! Just a few small questions not related to correctness.

ArrowSchemaViewValidate(schema_view, schema_view->type, error));
}

int64_t unknown_flags = schema->flags & ~ARROW_FLAG_DICTIONARY_ORDERED &
Copy link
Member

Choose a reason for hiding this comment

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

Would this be better as a macro or #define that is defined next to these other #defines? From a maintenance perspective, I'm mainly considering what happens if someone adds a new flag and forgets to update this part of the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea!

"ARROW_FLAG_MAP_KEYS_SORTED is only relevant for a map type");

schema.flags = 0;
schema.flags |= (ARROW_FLAG_MAP_KEYS_SORTED << 1);
Copy link
Member

Choose a reason for hiding this comment

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

We could use the new macro/define here to guarantee we always get an undefined value.

@danepitkin
Copy link
Member

@paleolimbot paleolimbot merged commit e175efb into apache:main Jan 26, 2024
31 checks passed
@paleolimbot paleolimbot deleted the unknown-flags branch January 29, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unknown flags should be zeroed when deep copying
3 participants