Context
Streaming window and time-oriented operators are tracked in #22032 — Streaming window support in cuDF-Polars (rolling, group_by_dynamic, ordered over(), shift, etc.). In practice these features almost always sit in sort-based workflows (by time or logical sequence).
Today, even when data is already sorted on disk, the executor will typically need to destroy that ordering to perform common group_by and join operations. Even when we do apply global sort operations, we don't keep track of this behavior in the executor, and will sometimes re-sort or shuffle data unnecessarily. Making ordering a first-class ChannelMetadata property (similar in spirit to how hash partitioning metadata is already tracked and preserved) should make the workloads highlighted in #22032 materially cheaper (less shuffle, less memory, simpler plans).
Dependency / alignment: rapidsmpf#853 — Add OrderScheme partitioning metadata (ordering in ChannelMetadata / partitioning). [DONE]
Sequencing
Context
Streaming window and time-oriented operators are tracked in #22032 — Streaming window support in cuDF-Polars (rolling,
group_by_dynamic, orderedover(),shift, etc.). In practice these features almost always sit in sort-based workflows (by time or logical sequence).Today, even when data is already sorted on disk, the executor will typically need to destroy that ordering to perform common
group_byandjoinoperations. Even when we do apply global sort operations, we don't keep track of this behavior in the executor, and will sometimes re-sort or shuffle data unnecessarily. Making ordering a first-classChannelMetadataproperty (similar in spirit to how hash partitioning metadata is already tracked and preserved) should make the workloads highlighted in #22032 materially cheaper (less shuffle, less memory, simpler plans).Dependency / alignment: rapidsmpf#853 — Add
OrderSchemepartitioning metadata (ordering inChannelMetadata/ partitioning). [DONE]Sequencing
OrderScheme: what it means per partition, across ranks, null ordering, multi-column keys, and when it must be cleared vs preserved (AdoptOrderSchememetadata in cudf-polars #22291)sort_actoremitsOrderScheme: After sort, set metadata downstream operators can trust. The sort_actor should also avoid sorting data that is already sorted (Use basicOrderSchememetadata insort_actor#22477)OrderSchemeto track multiple "orderings" at the same time (RefactorOrderSchemeto track multipleOrderingdescriptions #22896)enforce_partitioningthat will abstracts-away the process of aligning incoming data with a specificPartitioningspecification (whether that specification comprisesHashScheme,OrderScheme, or a combination of these. Prerequisites:OrderScheme.get_boundariesin RapidsMPF (AddOrderScheme.get_boundariesAPI rapidsmpf#1039): We need to be able to extract theboundariestable from anOrederSchemeobject in Python to sort the data with these boundaries.adjust_orderschemeutility (Addadjust_orderingutility #22628): We need to be able to adjust the boundaries and/or strictness of an existingOrderScheme.LocalRepartitioner.repartition_by_orderschemeutility (AddLocalRepartitioner.repartition_by_orderscheme#22522): We may have stratified partitioning. This utility will makeenforce_partitioningeasier to implement in a clean/consistent way for various partitioning schemes.enforce_partitioningto avoid unnecessary shuffling:enforce_partitioningingroupby_actorenforce_partitioninginjoin_actorenforce_partitioninginover_actorMergeSorted: This feature will depend onenforce_partitioningto align the partitioning of the input tables.MapFunction(“hint_sorted”)(i.e.set_sorted()): This API allows the user to inform Polars that a table is already sorted. This means the user may pre-shuffle their dataset(s) on specific keys, and useset_sortedto declare that we don't need to re-sort on these keys. Prerequisites:extract_orderscheme_partitioningutility (ExtractOrderSchememetadata from a sorted Channel #22526): This utility will extract theboundariestable from a channel that we know to be sorted.