Skip to content

Comments

FEAT/FIX: more consistent move behavior + options on reindex#1621

Open
ianhi wants to merge 8 commits intomainfrom
ian/fix/shift-array-modes
Open

FEAT/FIX: more consistent move behavior + options on reindex#1621
ianhi wants to merge 8 commits intomainfrom
ian/fix/shift-array-modes

Conversation

@ianhi
Copy link
Collaborator

@ianhi ianhi commented Feb 5, 2026

This PR makes (to my eye) the behavior of shift_array and reindex more consistent and explicit about user intent.

Wrapping and discard
Prior:

asymmetric behavior of chunk deletion vs error for negative and positive shfits: #1619

now: User must opt either to wrap mode or discard mode

reindex stale chunks vs deleting
Prior: reindex would always leave stale chunks if a chunk was moved but not replaced.
Now: user must chose between deleting vacated chunks or leaving them

shift_array return

since shift array works in chunk space it might be convenient for the user get back the shifts in array index space. I added a return to shift array for this.

Docs

move, shift_array, and reindex have docs pages now!

shift/reindex: https://icechunk--1621.org.readthedocs.build/en/1621/moving-chunks/
move: https://icechunk--1621.org.readthedocs.build/en/1621/moving-nodes/

@ianhi
Copy link
Collaborator Author

ianhi commented Feb 5, 2026

I still have the stateful tests to fill out with this new behavior (and i need to look more careful at the claude generated unit tests) but I wanted to open now to get a review on the behavior changes before I put that effort in. I know @dcherian was. committed to reviewing this, but for the behavior @paraseba would be great to hear from you.

@ianhi
Copy link
Collaborator Author

ianhi commented Feb 5, 2026

after talking wiht @dcherian :

  1. no more ability to delete vacated chunks - too slow!
  2. keep shift array discard behaivor on
  3. move the wrap behavior to a new function roll instead of splitting on arguments

test reindiex by using hypothesis property test (equivalent to vindex with a random array) using permutation

Copy link
Collaborator

@paraseba paraseba left a comment

Choose a reason for hiding this comment

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

I like what Deepak said too. Didn't look at the code in detail yet


Returns
-------
tuple[int, ...]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like this idea for the return type. The documentation may need an example.

array_path: str,
chunk_offset: Iterable[int],
) -> tuple[int, ...]:
"""Roll (circular shift) all chunks in an array by the given chunk offset.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a common use case? Can you give me examples?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Admittedly I can't think of one, but that would've also been true for shift-array. It seems to me like the other natural move operation that users will eventually want, so nice to not ask them to re-implement. its also the behavior I would've expected naively.

#1619 (comment)

@jbusecke
Copy link
Contributor

Reminder that I stole the --livereload part of the docs into #1640

@ianhi
Copy link
Collaborator Author

ianhi commented Feb 17, 2026

@paraseba is there anything more here? I think i addressed all of deepak's feedback

@ianhi ianhi force-pushed the ian/fix/shift-array-modes branch from 896c5da to ba9ddae Compare February 17, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants