Skip to content

Encoding RecordBatch Sort Order #284

Closed as not planned
Closed as not planned

Description

@tustvold

It is often the case that a RecordBatch is sorted lexicographically on one or more columns, and knowing this allows eliminating redundant sorts, more efficient lookups, etc...

To give a concrete use-case, within IOx data is compacted into sorted, read-only blocks that periodically must be merged together into new sorted, read-only blocks. The result is that we are performing a lot of operations on blocks of sorted data, that would benefit from being able to express that they are sorted.

It should be noted that the parquet format already has a similar concept stored in its metadata, see here although I've yet to find an implementation that actually makes use of it.

In the short-term I can workaround this with IOx-specific logic, but thought it worthwhile to maybe start a conversation about introducing some sort of standardised way to represent this in an arrow schema, as I imagine crates like Datafusion would also stand to benefit from this.

There are some areas that I can see being pretty gnarly, however. Datafusion, and I imagine other systems, use a single schema to refer to a collection of RecordBatches. Some logic would therefore be needed to compute the common sort order "prefix" between the record batches. A similar, but more complex issue would arise when merging schemas.

I'm not sure if this is even the right place to be raising this issue, but thought it couldn't hurt to do so 😄

Activity

  1. jorgecarleitao commented on May 11, 2021

    @jorgecarleitao
    Member

    This does not seem specific to the Rust implementation, but generic over the arrow format itself and how semantics are stored in the metadata. Could you raise this in the mailing list, where the arrow specification is discussed?

  2. changed the title [-]RecordBatch Sort Order[/-] [+]Encoding RecordBatch Sort Order[/+] on May 11, 2021
  3. tustvold commented on Mar 9, 2022

    @tustvold
    ContributorAuthor

    For reference apache/datafusion#1776 added a notion of sortedness to DataFusion's ExecutionPlan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions