feat(avro): extract avro datum from arrow array#166
Merged
zeroshade merged 3 commits intoapache:mainfrom Aug 18, 2025
Merged
Conversation
dongxiao1198
approved these changes
Aug 11, 2025
9d4b195 to
2f9a648
Compare
zhjwpku
approved these changes
Aug 14, 2025
| case ::arrow::Type::BOOL: { | ||
| const auto& bool_array = | ||
| internal::checked_cast<const ::arrow::BooleanArray&>(array); | ||
| datum->value<bool>() = bool_array.Value(index); |
Collaborator
There was a problem hiding this comment.
Do we need to check if the GenericDatum type matches the arrow::Array type?
Member
Author
There was a problem hiding this comment.
No, this is an internal API used by the Avro writer. Schemas of GenericDatum, ArrowArray and Iceberg should be consistent. The GenericDatum is reused so we don't want to check it repeatedly.
src/iceberg/avro/avro_data_util.cc
Outdated
| std::string_view value = fixed_array.GetView(index); | ||
| auto& fixed_datum = datum->value<::avro::GenericFixed>(); | ||
| fixed_datum.value().assign( | ||
| reinterpret_cast<const char*>(value.data()), |
Collaborator
There was a problem hiding this comment.
GenericFixed holds std::vector<uint8_t>, so cast to const uint8_t*?
Or, can this be implemented using begin/end iterators same as decimal128?
dongxiao1198
approved these changes
Aug 15, 2025
gty404
approved these changes
Aug 15, 2025
Member
Author
|
@Fokko @zeroshade Could you help review this? Thanks! |
zeroshade
approved these changes
Aug 18, 2025
Member
zeroshade
left a comment
There was a problem hiding this comment.
Just two nitpicks, otherwise LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.