Skip to content

Add adjust_ordering utility - #22628

Merged
rapids-bot[bot] merged 53 commits into
rapidsai:mainfrom
rjzamora:adjust-orderscheme
Jul 15, 2026
Merged

Add adjust_ordering utility#22628
rapids-bot[bot] merged 53 commits into
rapidsai:mainfrom
rjzamora:adjust-orderscheme

Conversation

@rjzamora

@rjzamora rjzamora commented May 21, 2026

Copy link
Copy Markdown
Member

Description

This utility is intended for operators that can exploit existing ordered/range-partitioned input, but require a different concrete boundary layout before they can do so safely. For example, a downstream operator may need to adjust from one strict Ordering to another with different boundaries, or convert metadata that is ordered but non-strict into strict output partitions before using chunkwise execution.

The immediate motivation is ordered join/groupby/sort planning in cudf-polars: once a stream is known to be ordered, we want to repartition only the boundary-overlap regions needed to align with the target operator, rather than falling back to a full shuffle or sort.

NOTE: "Strict" partitioning means that a unique value may only exist in one chunk. It is possible for the data to be ordered without "strict" partitioning, but we need to enforce strictness before doing a sort-based join or groupby.

Simple example: aligning ordered join inputs

Suppose two input streams are both ordered on the join keys, but their partition boundaries do not line up. A chunkwise join can only be used safely when corresponding output partitions cover the same key ranges. adjust_ordering provides the data-movement primitive for reshaping one ordered stream to match the other stream's strict boundaries, moving only the boundary-overlap pieces that need to change ranks.

This lets a downstream join operate partition-by-partition without requiring a full hash shuffle or global sort.

The same primitive can also be used by future groupby/sort optimizations that need to turn ordered-but-misaligned or non-strict partitioning into "strict" operator-ready partitions.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@rjzamora rjzamora self-assigned this May 21, 2026
@rjzamora rjzamora added feature request New feature or request 2 - In Progress Currently a work in progress non-breaking Non-breaking change labels May 21, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rjzamora
rjzamora marked this pull request as ready for review June 1, 2026 16:53
@rjzamora
rjzamora requested a review from a team as a code owner June 1, 2026 16:53
@rjzamora
rjzamora requested a review from Matt711 June 1, 2026 16:53
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds async operator adjust_orderscheme that validates OrderSchemes, computes row split points against output boundaries, splits incoming TableChunks, routes pieces locally or via a SparseAlltoall (with a hidden target-partition id), unpacks remote pieces, and emits per-partition Message(pid, chunk). Includes end-to-end tests for single- and multi-rank behaviors.

Changes

OrderScheme Adjustment Collective

Layer / File(s) Summary
Partition ownership helpers and scheme validation
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
Contiguous partition ownership utilities and validation enforcing strict output boundaries and that output keys are a prefix of input keys.
Row split point computation and boundary search
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
Compute split indices via pylibcudf.lower_bound and search corresponding lower/upper positions in the output boundary table respecting per-key ordering/null-ordering.
Packing helper and exchange routing
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
Append hidden target-partition id for remote payloads; derive source/destination ranks by mapping contiguous input partition ranges to output partition ranges and compute SparseAlltoall peers.
Unpack remote pieces and materialize chunks
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
Unpack received packed payloads to recover hidden pid and rebuild TableChunks; helper to copy/concatenate table views into owned TableChunks for emission.
Main adjust_orderscheme control flow
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
Async orchestrator: validate schemes, derive local targets, optionally wire SparseAlltoall, split and route pieces, unpack remote results, concatenate per-pid outputs (or emit empty), send Message(pid, chunk), and drain channels with exception-safe shutdown.
Test setup, helpers, and async harnesses
python/cudf_polars/tests/streaming/test_adjust_orderscheme.py
Test constants, boundary → OrderScheme builders, helpers converting between Polars frames and TableChunk, and async harnesses (_adjust_and_collect, _adjust_direct) to exercise the operator.
Parameterized and functional tests
python/cudf_polars/tests/streaming/test_adjust_orderscheme.py
Tests covering invalid-scheme rejection, collective_id enforcement, sparse boundary shifts across ranks, empty-owned-partition emission, all-empty input behavior, single-rank no-collective runs, and multi-chunk input handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

improvement

Suggested reviewers

  • Matt711
  • vyasr
  • wence-
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and refers to the new ordering-adjustment utility, though it uses a slightly different name than the implemented function.
Description check ✅ Passed The description clearly matches the change: it explains the SparseAlltoAll-based ordering adjustment utility and its intended uses.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py (2)

137-139: 💤 Low value

Unnecessary single-element concatenation.

plc.concatenate.concatenate is called with a single-element list. Constructing the table directly would be more efficient.

♻️ Suggested simplification
-    payload = plc.concatenate.concatenate(
-        [plc.Table(payload_cols)], stream=stream, mr=br.device_mr
-    )
+    payload = plc.Table(payload_cols)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py`
around lines 137 - 139, The call to plc.concatenate.concatenate with a single
element is unnecessary; replace the concatenation with a direct table
construction using plc.Table(payload_cols) instead of
plc.concatenate.concatenate([plc.Table(payload_cols)], stream=stream,
mr=br.device_mr). If plc.Table supports the stream and mr arguments, pass
stream=stream and mr=br.device_mr to plc.Table; otherwise construct
plc.Table(payload_cols) and set any required memory/stream settings via the
appropriate Table APIs rather than using concatenate.

180-209: 💤 Low value

Consider adding a Returns section to the docstring.

The function returns None, but for completeness and API documentation consistency, consider documenting the return value.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py`
around lines 180 - 209, The function whose docstring begins "Adjust flat
OrderScheme boundaries using contiguous partition ownership" currently omits a
Returns section; update that docstring to add a Returns entry documenting that
the function returns None (e.g., "Returns\n--------\nNone\n    This function
performs in-place adjustments and does not return a value.") so callers reading
the docstring for parameters like input_scheme, output_scheme, and collective_id
have a clear API contract.
python/cudf_polars/tests/streaming/test_adjust_orderscheme.py (2)

318-320: 💤 Low value

Variable keys shadows outer scope.

The loop variable keys on line 318 shadows the test input keys defined on line 296. Consider renaming to expected_keys for clarity.

Same pattern occurs on line 353.

✨ Suggested rename
-    for pid, keys in expected.items():
-        assert output[pid]["key"].to_list() == keys
-        assert output[pid]["val"].to_list() == keys
+    for pid, expected_keys in expected.items():
+        assert output[pid]["key"].to_list() == expected_keys
+        assert output[pid]["val"].to_list() == expected_keys
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py` around lines
318 - 320, The loop variable name keys in the test loop (for pid, keys in
expected.items()) shadows the outer test fixture/variable keys; rename the loop
variable to expected_keys (or another unambiguous name) and update the two
assertions to compare against expected_keys (output[pid]["key"].to_list() ==
expected_keys and output[pid]["val"].to_list() == expected_keys); apply the same
rename for the identical pattern later in the file (the second loop around line
353) so there is no shadowing.

289-355: ⚖️ Poor tradeoff

Consider adding edge case tests for all-null and single-element inputs.

Per coding guidelines, test files should cover edge cases including all-null columns and single-element Series. The empty partition case is well covered, but these additional cases would strengthen coverage of the adjust_orderscheme operator's handling of degenerate inputs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py` around lines
289 - 355, Add two new pytest cases that exercise _adjust_and_collect with
degenerate inputs: one where the input frame produced by _frame contains columns
that are all null (e.g., "key" or "val" series all-null) and one where the input
has a single-element Series; reuse the existing patterns from
test_adjust_orderscheme_emits_empty_owned_partitions and
test_adjust_orderscheme_single_rank_no_collective to create context, comm,
stream, input_scheme via _make_scheme and call _adjust_and_collect, then assert
outputs by pid as in the existing tests; ensure you parametrize/skip for nranks
like the other tests and reference the helper functions _frame, _make_scheme and
_adjust_and_collect so the new tests integrate with the current test
scaffolding.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py`:
- Around line 228-289: The receive/split/send loop in adjust_orderscheme doesn't
guard ch_in/ch_out and exchange finalization on exceptions; wrap the main async
work in shutdown_on_error(context, ch_in, ch_out) (or add a try/finally) so that
on any exception you always call await exchange.insert_finished(context) if
exchange is not None, drain/shutdown ch_out (await ch_out.drain(context) and
ch_out.shutdown/context-equivalent), and ensure ch_in is closed; locate this
around the loop using symbols adjust_orderscheme, ch_in, ch_out, exchange,
exchange.insert_finished, and ch_out.drain to implement the try/finally or async
context manager to guarantee cleanup.

---

Nitpick comments:
In
`@python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py`:
- Around line 137-139: The call to plc.concatenate.concatenate with a single
element is unnecessary; replace the concatenation with a direct table
construction using plc.Table(payload_cols) instead of
plc.concatenate.concatenate([plc.Table(payload_cols)], stream=stream,
mr=br.device_mr). If plc.Table supports the stream and mr arguments, pass
stream=stream and mr=br.device_mr to plc.Table; otherwise construct
plc.Table(payload_cols) and set any required memory/stream settings via the
appropriate Table APIs rather than using concatenate.
- Around line 180-209: The function whose docstring begins "Adjust flat
OrderScheme boundaries using contiguous partition ownership" currently omits a
Returns section; update that docstring to add a Returns entry documenting that
the function returns None (e.g., "Returns\n--------\nNone\n    This function
performs in-place adjustments and does not return a value.") so callers reading
the docstring for parameters like input_scheme, output_scheme, and collective_id
have a clear API contract.

In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py`:
- Around line 318-320: The loop variable name keys in the test loop (for pid,
keys in expected.items()) shadows the outer test fixture/variable keys; rename
the loop variable to expected_keys (or another unambiguous name) and update the
two assertions to compare against expected_keys (output[pid]["key"].to_list() ==
expected_keys and output[pid]["val"].to_list() == expected_keys); apply the same
rename for the identical pattern later in the file (the second loop around line
353) so there is no shadowing.
- Around line 289-355: Add two new pytest cases that exercise
_adjust_and_collect with degenerate inputs: one where the input frame produced
by _frame contains columns that are all null (e.g., "key" or "val" series
all-null) and one where the input has a single-element Series; reuse the
existing patterns from test_adjust_orderscheme_emits_empty_owned_partitions and
test_adjust_orderscheme_single_rank_no_collective to create context, comm,
stream, input_scheme via _make_scheme and call _adjust_and_collect, then assert
outputs by pid as in the existing tests; ensure you parametrize/skip for nranks
like the other tests and reference the helper functions _frame, _make_scheme and
_adjust_and_collect so the new tests integrate with the current test
scaffolding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0fee68f4-d44e-47a4-90b1-08a10f9beff4

📥 Commits

Reviewing files that changed from the base of the PR and between b8a14e2 and 45746e5.

📒 Files selected for processing (2)
  • python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
  • python/cudf_polars/tests/streaming/test_adjust_orderscheme.py

Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py Outdated
@rjzamora rjzamora added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Jun 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
python/cudf_polars/tests/streaming/test_adjust_orderscheme.py (1)

305-341: ⚡ Quick win

Add null and single-row coverage before merge.

The new suite exercises empty inputs and chunk accumulation, but it never hits all-null or single-element partitions. Since _make_scheme fixes NullOrder.BEFORE, a regression around null boundary placement or degenerate one-row inputs would slip through here.

As per coding guidelines, python/**/test_*.py: "Ensure test files provide comprehensive edge case coverage (empty, all-null, single-element, mixed types)".

Also applies to: 376-396

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py` around lines
305 - 341, The test test_adjust_orderscheme_all_empty_input only covers empty
inputs; add cases that exercise all-null partitions and single-row partitions to
catch regressions in null ordering and degenerate partitions: create additional
calls (or parametrize) to _adjust_and_collect using _frame with rows that are
all null for the key column(s) and with single-row frames, using the same
input_scheme/output_scheme setup (which uses _make_scheme and fixes
NullOrder.BEFORE) and run both the single-rank branch and the collective branch
(reserve_op_id / collective_id) as done currently; assert results with
_assert_partition_output to verify behavior for all-null and single-element
partitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py`:
- Around line 157-164: The helper _assert_partition_output currently only checks
that "val" equals "key" which won't catch payload misalignment; change
tests/fixtures to produce distinct non-key payloads (make val different from
key) and update _assert_partition_output (and its callers) to assert keys and
vals independently (e.g., expected should include per-partition key lists and
per-partition val lists, and _assert_partition_output should compare
output[pid]["key"].to_list() to expected_keys and output[pid]["val"].to_list()
to expected_vals). Locate the helper by name (_assert_partition_output) and
update any fixtures or expected dicts used by tests to provide independent val
data so row/column misalignment is detected.

---

Nitpick comments:
In `@python/cudf_polars/tests/streaming/test_adjust_orderscheme.py`:
- Around line 305-341: The test test_adjust_orderscheme_all_empty_input only
covers empty inputs; add cases that exercise all-null partitions and single-row
partitions to catch regressions in null ordering and degenerate partitions:
create additional calls (or parametrize) to _adjust_and_collect using _frame
with rows that are all null for the key column(s) and with single-row frames,
using the same input_scheme/output_scheme setup (which uses _make_scheme and
fixes NullOrder.BEFORE) and run both the single-rank branch and the collective
branch (reserve_op_id / collective_id) as done currently; assert results with
_assert_partition_output to verify behavior for all-null and single-element
partitions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 76ca8654-f462-49d1-aaaf-ea2fcf7e62c6

📥 Commits

Reviewing files that changed from the base of the PR and between 45746e5 and 1f6697e.

📒 Files selected for processing (2)
  • python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py
  • python/cudf_polars/tests/streaming/test_adjust_orderscheme.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/orderscheme.py

Comment thread python/cudf_polars/tests/streaming/test_adjust_orderscheme.py Outdated
@rjzamora rjzamora added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Jul 13, 2026
@rjzamora
rjzamora marked this pull request as ready for review July 13, 2026 18:47
@rjzamora rjzamora changed the title [WIP] Add adjust_ordering utility Add adjust_ordering utility Jul 13, 2026
@TomAugspurger

Copy link
Copy Markdown
Contributor

Could you give a bit more context (either here, or preferably in the adjust_ordering docstring) about when and why this might be used? The PR description mentions "The utility will typically be used to adjust boundaries or convert from non-strict to strict boundaries." so maybe start there and include a bit about what sort of operations will use this.

@rjzamora

Copy link
Copy Markdown
Member Author

@TomAugspurger - Added more info to the PR description, but I can revise and/or add info to the code/comments if necessary.

@TomAugspurger TomAugspurger left a comment

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.

About halfway through reviewing, moving onto the collective part next.

Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
if comm.nranks > 1 and collective_id is None:
raise ValueError("collective_id is required when comm.nranks > 1.")

try:

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.

Nitpick: this try/except stuff could be put in an async context manager, similar to shutdown_on_error

@asynccontextmanager
async def cleanup_on_error(...):
    try:
        yield
    except Exception:
        await gather_in_task_group(...)
        raise

and _adjust_ordering_impl could be inlined here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, I think I understand. I'm updating utils.py a bit so we have re-usable primitives for cleaning up channels when we are doing something like this at a finer granularity than an actor.

Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
[_PID_DTYPE],
stream,
)
.to_polars()["split"]

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.

Just confirming: this effectively introduces a stream synchronization here, right? So that we can get the list[int] split points back on the host?

Same with def _boundary_search_positions. Might be worth documenting that.

@TomAugspurger TomAugspurger left a comment

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.

One high-level question I have: why doesn't this return anything?

IIUC, the way it operates is to takes some data that's flowing through some Channels. And we'll somehow transform the messages sent on those Channels to honor the desired output_ordering

Will the caller need to know that the result is now ordered by output_ordering?

Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment on lines +286 to +288
while not self.input_done and not any(
pending_pid >= stop for pending_pid in self.pending
):

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 was a little worried about an infinite loop here since the loop body doesn't modify any of the loop conditions in some cases, but I believe that _store_chunk mutates self.pending, which eventually makes the any(...) False.

Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
Comment thread python/cudf_polars/cudf_polars/streaming/actor_graph/collectives/ordering.py Outdated
@rjzamora

rjzamora commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review @TomAugspurger ! I think I've addressed most comments/suggestions at this point.

One high-level question I have: why doesn't this return anything?

The intention is for this utility to be used within an actor (e.g. groubpy_actor/join_actor) to update the boundaries for a table that is already ordered with a compatible Ordering specification. For group_by, this typically means that we are ordered on a pre-fix of key columns, but the Ordering is not known to be "strict" (and so some unique values my fall on either side of one or more chunk boundaries). For join, this typically means we have two tables that are ordered on a prefix of the join keys, but the boundaries don't align (or one or more of the orderings is not "strict").

We don't "return" anything, because we are requiring the properly-ordered data to be emitted from the output channel. If the ordering cannot be adjusted, there is a bug in the code, and we should have never called this utility to begin with.

IIUC, the way it operates is to takes some data that's flowing through some Channels. And we'll somehow transform the messages sent on those Channels to honor the desired output_ordering

Will the caller need to know that the result is now ordered by output_ordering?

The caller is guaranteed that the data flowing out of ch_out will satisfy output_ordering. Otherwise, there is a bug or an error. Just as a groupby_actor might shuffle data internally, and expect the shuffle to do what it promises to do, this adjust_ordering utility "promises" to enforce output_ordering.

I suppose we could call this enforce_ordering. However, it's important that this utility is only used to change/update/modify/adjust the boundaries of a table that is already ordered. We are trusting that the input_ordering specification is correct. Otherwise, the algorithms we use here are simply wrong.

@TomAugspurger

Copy link
Copy Markdown
Contributor

Makes sense, thanks.

@rjzamora rjzamora added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jul 15, 2026
@rjzamora

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit af9ac19 into rapidsai:main Jul 15, 2026
110 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jul 15, 2026
@rjzamora
rjzamora deleted the adjust-orderscheme branch July 15, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to Merge Testing and reviews complete, ready to merge cudf-polars Issues specific to cudf-polars feature request New feature or request non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants