-
Notifications
You must be signed in to change notification settings - Fork 41
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
639a8a4
to
3db47c2
Compare
Overall LGTM! Just a few small questions not related to correctness. |
src/nanoarrow/schema.c
Outdated
ArrowSchemaViewValidate(schema_view, schema_view->type, error)); | ||
} | ||
|
||
int64_t unknown_flags = schema->flags & ~ARROW_FLAG_DICTIONARY_ORDERED & |
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.
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.
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.
Great idea!
src/nanoarrow/schema_test.cc
Outdated
"ARROW_FLAG_MAP_KEYS_SORTED is only relevant for a map type"); | ||
|
||
schema.flags = 0; | ||
schema.flags |= (ARROW_FLAG_MAP_KEYS_SORTED << 1); |
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.
We could use the new macro/define here to guarantee we always get an undefined value.
✅ |
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 offlags
(or perhaps each flag individually), but I will leave that to another PR.