Skip to content

fix:[9018]Fixed RunArray slice offsets#9036

Merged
Jefffrey merged 1 commit intoapache:mainfrom
manishkr:9018-fix-runarray-kernel
Jan 13, 2026
Merged

fix:[9018]Fixed RunArray slice offsets#9036
Jefffrey merged 1 commit intoapache:mainfrom
manishkr:9018-fix-runarray-kernel

Conversation

@manishkr
Copy link
Copy Markdown
Contributor

@manishkr manishkr commented Dec 23, 2025

Which issue does this PR close?

Rationale for this change

To consider offset in slicing of RunArray.

What changes are included in this PR?

  1. Considered offset in slicing of RunArray.
  2. Enhanced RunArray slice API.

Are these changes tested?

yes

Are there any user-facing changes?

Yes, extended API to access RunArray slices directly than getting it from index.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Dec 23, 2025
@manishkr
Copy link
Copy Markdown
Contributor Author

manishkr commented Dec 23, 2025

Looking into test(intermittent) case failure.

@manishkr manishkr force-pushed the 9018-fix-runarray-kernel branch from b17d380 to d9e54fb Compare December 24, 2025 12:31
@manishkr
Copy link
Copy Markdown
Contributor Author

Need help on.
Archery test With other arrows
The hosted runner lost communication with the server. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

@Jefffrey
Copy link
Copy Markdown
Contributor

Need help on. Archery test With other arrows The hosted runner lost communication with the server. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

Can ignore, it's an unrelated issue: #9024

Copy link
Copy Markdown
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up. Left some comments, also changed PR body to not close original issue as I still need to check what other kernels/code might need fixing.

@manishkr manishkr force-pushed the 9018-fix-runarray-kernel branch from d9e54fb to 6fb02cd Compare December 27, 2025 06:55
@manishkr
Copy link
Copy Markdown
Contributor Author

Thanks for picking this up. Left some comments, also changed PR body to not close original issue as I still need to check what other kernels/code might need fixing.

Thanks for reviewing and feedback. If you permit, once this PR is good to go, can take this.

Comment on lines +192 to +196
/// Similar to [`values`] but accounts for logical slicing, returning only the values
/// that are part of the logical slice of this buffer.
///
/// [`values`]: Self::values
pub fn values_slice(&self) -> &[E] {
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.

I think for this docstring we also need a clear warning note that the first & last run values may be inaccurate as they don't take into account the logical slicing. I wonder if there is a better way to handle this without too much overhead 🤔

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.

Thanks. Added warning but not sure logical run ends API(logical_run_ends) is needed or not, but added it. Please feel free to suggest to remove it.

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.

I quite like the logical_run_ends() API actually; it makes it harder to unintentionally misuse values_slice(). I'm thinking we remove values_slice() and expose only logical_run_ends(), since users can always derive values_slice() for themselves manually anyway.

My only comment is perhaps rename logical_run_ends() to something else, since it might be confusing with how we describe physical vs logical in the docstring for the struct. Perhaps something like sliced_values()?

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.

Thanks. Removed values_slice and renamed logical_run_ends to sliced_values. Without values_slice, it is unclear whether adding get_physical_len would be useful for end users?

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.

Without values_slice, it is unclear whether adding get_physical_len would be useful for end users?

Could you elaborate on this? I don't recall discussing adding a get_physical_len() API 🤔

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.

It's my suggestion. I was thinking, would a get_physical_len API be useful for end users?

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.

It's probably fine to omit for now, I don't see a use for it

@manishkr manishkr force-pushed the 9018-fix-runarray-kernel branch from 6fb02cd to 57e6a3c Compare December 30, 2025 07:36
@manishkr
Copy link
Copy Markdown
Contributor Author

manishkr commented Jan 5, 2026

@Jefffrey Please help to close this. Thanks

@Jefffrey
Copy link
Copy Markdown
Contributor

Jefffrey commented Jan 5, 2026

I'll try take another look soon.

Copy link
Copy Markdown
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

Apologies it took me so long to re-review, I'll try to prioritise this so we can get it over the line 👍

Comment on lines +192 to +196
/// Similar to [`values`] but accounts for logical slicing, returning only the values
/// that are part of the logical slice of this buffer.
///
/// [`values`]: Self::values
pub fn values_slice(&self) -> &[E] {
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.

I quite like the logical_run_ends() API actually; it makes it harder to unintentionally misuse values_slice(). I'm thinking we remove values_slice() and expose only logical_run_ends(), since users can always derive values_slice() for themselves manually anyway.

My only comment is perhaps rename logical_run_ends() to something else, since it might be confusing with how we describe physical vs logical in the docstring for the struct. Perhaps something like sliced_values()?

@manishkr manishkr force-pushed the 9018-fix-runarray-kernel branch from 57e6a3c to a2b3af9 Compare January 11, 2026 09:49
assert_eq!(buffer.get_end_physical_index(), 0);
}
#[test]
fn test_sliced_buffer_access() {
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 test probably can be removed now that we don't have values_slice()

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.

Done. Thanks

Comment on lines +192 to +196
/// Similar to [`values`] but accounts for logical slicing, returning only the values
/// that are part of the logical slice of this buffer.
///
/// [`values`]: Self::values
pub fn values_slice(&self) -> &[E] {
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.

Without values_slice, it is unclear whether adding get_physical_len would be useful for end users?

Could you elaborate on this? I don't recall discussing adding a get_physical_len() API 🤔

@manishkr manishkr force-pushed the 9018-fix-runarray-kernel branch from a2b3af9 to bfbe554 Compare January 11, 2026 11:44
@manishkr
Copy link
Copy Markdown
Contributor Author

@Jefffrey Thank you for approving this request. I appreciate your feedback, which helps improve it with each iteration.

@Jefffrey Jefffrey merged commit b904318 into apache:main Jan 13, 2026
26 checks passed
@Jefffrey
Copy link
Copy Markdown
Contributor

Thanks @manishkr

@manishkr manishkr deleted the 9018-fix-runarray-kernel branch January 13, 2026 05:23
Dandandan pushed a commit to Dandandan/arrow-rs that referenced this pull request Jan 15, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Part of apache#9018 .

# Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
To consider offset in slicing of RunArray.

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
1. Considered offset in slicing of RunArray.
2. Enhanced RunArray slice API.
# Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
3. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
yes
# Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
Yes, extended API to access RunArray slices directly than getting it
from index.
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.

2 participants