Skip to content

[C++][Compute] Fix null sorting of multiple sort keys #38558

Closed

Description

@Light-City

Describe the bug, including details regarding any error messages, version, and platform.

Currently, NullPlacement is a global control, and this parameter is used for all sortkeys. However, for databases like pg, it should be one for each sortkey, for example:

order by i nulls first, j, k nulls first;

code is

  /// Column key(s) to order by and how to order by these sort keys.
  std::vector<SortKey> sort_keys;
  /// Whether nulls and NaNs are placed at the start or at the end
  NullPlacement null_placement;

Component(s)

C++

Activity

  1. changed the title [-]Fix null sorting of multiple sort keys[/-] [+][C++] Fix null sorting of multiple sort keys[/+] on Nov 2, 2023
  2. changed the title [-][C++] Fix null sorting of multiple sort keys[/-] [+][C++][Compute] Fix null sorting of multiple sort keys[/+] on Nov 2, 2023
  3. mapleFU commented on Nov 2, 2023

    @mapleFU
    Member

    So the NullPlacement should support being std::vector<NullPlacement> ?

  4. kou commented on Nov 2, 2023

    @kou
    Member

    How about moving NullPlacement to SortKey?

  5. Light-City commented on Nov 2, 2023

    @Light-City
    ContributorAuthor

    So the NullPlacement should support being std::vector<NullPlacement> ?

    yes.

  6. Light-City commented on Nov 2, 2023

    @Light-City
    ContributorAuthor

    How about moving NullPlacement to SortKey?
    In this case, it's better

  7. Light-City commented on Nov 2, 2023

    @Light-City
    ContributorAuthor

    If no one does it, I can try to implement it

  8. mapleFU commented on Nov 2, 2023

    @mapleFU
    Member

    Also cc @bkietz @ianmcook for some info here

  9. bkietz commented on Nov 2, 2023

    @bkietz
    Member
  10. Light-City commented on Nov 3, 2023

    @Light-City
    ContributorAuthor

    It has been implemented, I will send a PR later, haha

  11. llama90 commented on Nov 3, 2023

    @llama90
    Contributor

    I saw a comment about difficulties with sorting for multiple batches (ChunkedArray, Table), but it looks like you've solved it. lol

    I'm interested in this issue because I'm interested in sorting for DictionaryType in multiple batches.

  12. Light-City commented on Nov 6, 2023

    @Light-City
    ContributorAuthor

    I found that the NullPlacement in the selectk scenario is all hard-coded AtEnd. It should also be modified correctly. Take this opportunity to apply it to each SortKey.

  13. Light-City commented on Nov 9, 2023

    @Light-City
    ContributorAuthor
  14. added a commit that references this issue on Jun 22, 2026
  15. added this to the 25.0.0 milestone on Jun 22, 2026
  16. pitrou commented on Jun 22, 2026

    @pitrou
    Member

    Issue resolved by pull request 46926
    #46926

  17. taepper commented on Jun 22, 2026

    @taepper
    Contributor

    Great! Thanks @pitrou!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions