Skip to content

Conversation

@EduardAkhmetshin
Copy link
Contributor

@EduardAkhmetshin EduardAkhmetshin commented Jan 6, 2026

Which issue does this PR close?

What changes are included in this PR?

Documentation on union types encoding in https://arrow.apache.org/rust/arrow_row/struct.RowConverter.html.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes. https://arrow.apache.org/rust/arrow_row/struct.RowConverter.html will get updated.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jan 6, 2026
@EduardAkhmetshin EduardAkhmetshin changed the title Add union documentation Add Union encoding documentation Jan 6, 2026
@EduardAkhmetshin
Copy link
Contributor Author

EduardAkhmetshin commented Jan 6, 2026

I tested union encoding myself, and the behaviour that I observed differed from the original proposal in #8828. I based my examples on the actual behaviour to the best of my knowledge. Please let me know if something is wrong.

@alamb
Copy link
Contributor

alamb commented Jan 6, 2026

@friendlymatthew -- can you help review this?

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks -- I went over this carefully and I think it looks correct and really nicely explained. Thank you @EduardAkhmetshin

cc @Jefffrey

Comment on lines +473 to +476
/// ## Union Ordering
///
/// Values of the same type are ordered according to the ordering of that type.
/// Values of different types are ordered by their type id.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to mention reversing via negating the type_id here:

arrow-rs/arrow-row/src/lib.rs

Lines 1742 to 1747 in 2507946

let type_id_byte = if opts.descending {
!(type_id as u8)
} else {
type_id as u8
};
data[*offset] = type_id_byte;

Copy link
Contributor

Choose a reason for hiding this comment

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

Since I am trying to prepare the 57.2.0 I took the liberty of making this change directly to this PR in 08efd42. If I got it wrong or you would like other changes, I will be happy to make a follow on PR

@alamb alamb added the documentation Improvements or additions to documentation label Jan 7, 2026
@alamb alamb merged commit 28f66f9 into apache:main Jan 7, 2026
13 checks passed
@alamb
Copy link
Contributor

alamb commented Jan 7, 2026

Thanks again @EduardAkhmetshin @Jefffrey and @friendlymatthew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update arrow-row documentation with Union encoding

3 participants