You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Andy Grove (JIRA)" <ji...@apache.org> on 2019/02/03 17:28:00 UTC

[jira] [Created] (ARROW-4465) [Rust] [DataFusion] Add support for ORDER BY

Andy Grove created ARROW-4465:
---------------------------------

             Summary: [Rust] [DataFusion] Add support for ORDER BY
                 Key: ARROW-4465
                 URL: https://issues.apache.org/jira/browse/ARROW-4465
             Project: Apache Arrow
          Issue Type: Improvement
          Components: Rust
            Reporter: Andy Grove
             Fix For: 0.13.0


As a user, I would like to be able to specify an ORDER BY clause on my query.

Work involved:
 * Add OrderBy to LogicalPlan enum
 * Write query planner code to translate SQL AST to OrderBy (SQL parser that we use already supports parsing ORDER BY)
 * Implement SortRelation

My high level thoughts on implementing the SortRelation:
 * Create Arrow array of uint32 same size as batch and populate such that each element contains its own index i.e. array will be 0, 1, 2, 3....
 * Find a Rust crate for sorting that allows us to provide our own comparison lambda
 * Implement the comparison logic (probably can reuse existing execution code - see filter.rs for how it implements comparison expressions)
 * Use index array to store the result of the sort i.e. no need to rewrite the whole batch, just the index
 * Rewrite the batch after the sort has completed

It would also be good to see how Gandiva has implemented this

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)