-
Notifications
You must be signed in to change notification settings - Fork 4.2k
GH-50249: [C++] Add ArrayBuilder::IsValid and ArrayBuilder::IsNull #50402
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
base: main
Are you sure you want to change the base?
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,6 +111,25 @@ class ARROW_EXPORT ArrayBuilder { | |||||||||||
|
|
||||||||||||
| int num_children() const { return static_cast<int>(children_.size()); } | ||||||||||||
|
|
||||||||||||
| /// \brief Return true if value at index is null. Does not boundscheck | ||||||||||||
| bool IsNull(int64_t i) const { return !IsValid(i); } | ||||||||||||
|
|
||||||||||||
| /// \brief Return true if value at index is valid (not null). Does not | ||||||||||||
| /// boundscheck. | ||||||||||||
| /// Note that this method does not work for types that do not have a | ||||||||||||
| /// top-level validity bitmap (Union and Run-End Encoded (RLE) types). | ||||||||||||
|
Comment on lines
+119
to
+120
Member
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. It's not exactly that it does not work, it's that it doesn't account for logical nulls.
Suggested change
|
||||||||||||
| bool IsValid(int64_t i) const { | ||||||||||||
| switch (type()->id()) { | ||||||||||||
| case Type::NA: | ||||||||||||
| case Type::SPARSE_UNION: | ||||||||||||
| case Type::DENSE_UNION: | ||||||||||||
| case Type::RUN_END_ENCODED: | ||||||||||||
|
Comment on lines
+124
to
+126
Member
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. These three should return
Member
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. cc @zanmato1984 for opinions
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. I don't think So I think we either need to narrow the API semantics/name to physical/top-level validity, e.g. |
||||||||||||
| return false; | ||||||||||||
| default: | ||||||||||||
| return bit_util::GetBit(null_bitmap_builder_.data(), i); | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| virtual int64_t length() const { return length_; } | ||||||||||||
| int64_t null_count() const { return null_count_; } | ||||||||||||
| int64_t capacity() const { return capacity_; } | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.