8000 feat(nodejs): add order_by method to Query by ddupg · Pull Request #3123 · lancedb/lancedb · GitHub
[go: up one dir, main page]

Skip to content

feat(nodejs): add order_by method to Query#3123

Open
ddupg wants to merge 6 commits intolancedb:mainfrom
ddupg:feat/nodejs-sort
Open

feat(nodejs): add order_by method to Query#3123
ddupg wants to merge 6 commits intolancedb:mainfrom
ddupg:feat/nodejs-sort

Conversation

@ddupg
Copy link
Contributor
@ddupg ddupg commented Mar 11, 2026

No description provided.

@github-actions github-actions bot added enhancement New feature or request Rust Rust related issues labels Mar 11, 2026
@ddupg ddupg force-pushed the feat/nodejs-sort branch 3 times, most recently from ec7181f to 6072c67 Compare March 11, 2026 02:12
@ddupg
Copy link
Contributor Author
ddupg commented Mar 11, 2026

The current CI failure appears to be unrelated to my changes in this PR.

cargo clippy --profile ci --all --all-features -- -D warnings
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    RUST_BACKTRACE: 1
    CC: gcc-12
    CXX: g++-12
    CARGO_INCREMENTAL: 0
    CARGO_PROFILE_DEV_DEBUG: 0
    CARGO_TERM_COLOR: always
    RUSTFLAGS: -D warnings
    CARGO_UNSTABLE_SPARSE_REGISTRY: true
    CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
    CACHE_ON_FAILURE: false
error: failed to parse lock file at: /home/runner/work/lancedb/lancedb/Cargo.lock

Caused by:
  package `snafu-derive` is specified twice in the lockfile
Error: Process completed with exit code 101.

Fixed it in #3124

@ddupg ddupg force-pushed the feat/nodejs-sort branch from 6072c67 to 07e9981 Compare March 11, 2026 02:47
@jackye1995
Copy link
Contributor

@ddupg I merged 3124, could you help rebase?

@ddupg ddupg force-pushed the feat/nodejs-sort branch from 07e9981 to c1ba89b Compare March 11, 2026 05:25
Change-Id: Iae6a968081a9aed9b7cd0db0d6e32710b693cb83
@ddupg ddupg force-pushed the feat/nodejs-sort branch from c1ba89b to 628e3cc Compare March 11, 2026 05:36
self
}

fn order_by(mut self, column: impl Into<String>, direction: SortDirection) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not match the lance api and just expose order_by(&mut self, ordering: Option<Vec<ColumnOrdering>>)?

* .toArray();
* ```
*/
orderBy(column: string, direction: "asc" | "desc" = "asc"): this {
Copy link
Contributor

Choose a reason for hiding this comment

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

in general we need to keep parity of python and typescript implementation, this is small enough change can we just add them in the same PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review.

Python currently supports ordering by providing the ordering_field_name field during search, like:

    def search(
        self,
        query: Optional[
            Union[VEC, str, "PIL.Image.Image", Tuple, FullTextQuery]
        ] = None,
        vector_column_name: Optional[str] = None,
        query_type: QueryType = "auto",
        ordering_field_name: Optional[str] = None,
        fts_columns: Optional[Union[str, List[str]]] = None,
    ) -> LanceQueryBuilder:

When you mentioned "keep parity of Python and TypeScript implementation", are you referring to the ordoring direction?

ddupg added 5 commits March 11, 2026 16:55
- Update QueryBase::order_by signature to accept Option<Vec<ColumnOrdering>>
- Re-export ColumnOrdering from Lance in lib.rs
- Update QueryRequest.order_by field type
- Remove unused SortDirection import from table/query.rs
- Update table/query.rs to pass order_by directly to scanner

Change-Id: I82667e17e8f3e0d82be71227bbb480353edb92a7
- Update QueryBase::order_by signature to accept Option<Vec<ColumnOrdering>>
- Re-export ColumnOrdering from Lance in lib.rs
- Update QueryRequest.order_by field type
- Remove unused SortDirection import from table/query.rs
- Update table/query.rs to pass order_by directly to scanner

Change-Id: I5a9610f2b5679c1a8a6a48621962bc912606c1db
- Update RemoteTable to pass Vec<ColumnOrdering> to scanner
- Fix serialization of order_by parameter

Change-Id: Ic2f988e5be2744e3b6ce045b02539712ca2ae822
- Update RemoteTable to pass Vec<ColumnOrdering> to scanner
- Fix serialization of order_by parameter

Change-Id: I8b7436814ca2bf56a5bab7a30b8466b72f0dbd03
Change-Id: Id4bf2c48027d9382f84293d5383dac09045e0eec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Rust Rust related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0