Skip to content

API to help with the pattern of 'replaces the values of the REE array#9891

Open
Rich-T-kid wants to merge 2 commits intoapache:mainfrom
Rich-T-kid:rich-T-kid/REE-values-take
Open

API to help with the pattern of 'replaces the values of the REE array#9891
Rich-T-kid wants to merge 2 commits intoapache:mainfrom
Rich-T-kid:rich-T-kid/REE-values-take

Conversation

@Rich-T-kid
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

over time the pattern of replacing REE values without creating a new instance has emerged, buts approached have been scatered. this PR attempts to consolidate them into a single place.

What changes are included in this PR?

Includes updating call sites that used to manually replace REE values by constructing new ones, switching them to use a macro instead.

Are these changes tested?

yes

Are there any user-facing changes?

no

@Rich-T-kid Rich-T-kid marked this pull request as ready for review May 4, 2026 16:07
@github-actions github-actions Bot added the arrow Changes to the arrow crate label May 4, 2026
Copy link
Copy Markdown
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.

Looks good to me -- thank you @Rich-T-kid

I have a sugestion on how to make this slightly more efficient by reusing the field -- but that can be done as a follow on PR too potentially

Comment thread arrow-array/src/array/run_array.rs
Comment thread arrow-array/src/array/run_array.rs Outdated
Comment thread arrow-array/src/array/run_array.rs Outdated
let new_array = array.with_values(values);
Ok(new_array)
}
DataType::RunEndEncoded(k, _) => match k.data_type() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is unrelated to adding with_values, right? It is adding REE support to date_part 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea I noticed it while I was going through spots in the codebase that used this pattern. its was a pretty small change so I included it in this PR

@Rich-T-kid
Copy link
Copy Markdown
Contributor Author

@alamb I revised the PR. Thank you 😄

@Rich-T-kid Rich-T-kid force-pushed the rich-T-kid/REE-values-take branch from 0bc52ac to 70e5f4e Compare May 5, 2026 01:00
/// This macro is useful for implementing functions that should work on the logical values
/// of a REE array while preserving the run-end encoding structure.
#[macro_export]
macro_rules! ree_map {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about having a AnyRunArray trait like we do for AnyDictionaryArray? This way users can downcast to AnyRunArray instead of needing to cast to each individual key type which the macro still requires

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make an API to help with the pattern of 'replaces the values of the REE array'

3 participants