Skip to content

feat: Default to NULLS LAST #2617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2023
Merged

feat: Default to NULLS LAST #2617

merged 1 commit into from
May 30, 2023

Conversation

max-sixty
Copy link
Member

As discussed in #2601

@aljazerzen
Copy link
Member

I've read the documentation you've written and realized that I don't support this option.

The DuckDB PR lists 4 options:

  1. NULLS FIRST when ASC, NULLS LAST when DESC
  2. NULLS LAST when ASC, NULLS FIRST when DESC
  3. Always NULLS FIRST
  4. Always NULLS LAST

They switched from option 3 to option 4. This PR is now also switching PRQL to option 4.

I'm suggesting we don't use any and force users to either:

  • specify that their columns don't contain nulls or,
  • use nulls_first or nulls_last ordering.

Justification became very long, so I'll open an issue about this. This PR can be merged not to stall the development, we can revert later.

@eitsupi
Copy link
Member

eitsupi commented May 29, 2023

Wondering if this change is a blocker of 0.9.0 release.
Do we merge this immediately? Or should we delay merging until #2622 is resolved?

@aljazerzen
Copy link
Member

This is not a breaking change (we didn't guarantee position of the NULLs before), and will not be a breaking change if we remove it (we still don't guarantee position of the NULLs now). Because #2622 will take some time to be resolved fully, let's merge this now and update it later.

@eitsupi eitsupi changed the title feat!: Default to NULLS LAST feat: Default to NULLS LAST May 30, 2023
commit a9e9987
Merge: 1e182e7 6768560
Author: Aljaž Mur Eržen <[email protected]>
Date:   Tue May 30 15:04:21 2023 +0200

    Merge remote-tracking branch 'origin/main' into nulls-last

commit 1e182e7
Author: Aljaž Mur Eržen <[email protected]>
Date:   Tue May 30 15:04:03 2023 +0200

    fix

commit e2a225d
Author: Aljaž Mur Eržen <[email protected]>
Date:   Tue May 30 13:49:12 2023 +0200

    fix

commit 006ccb0
Author: Aljaž Mur Eržen <[email protected]>
Date:   Tue May 30 13:35:21 2023 +0200

    update sort docs

commit c04e21e
Merge: 6b474e8 66e0bf6
Author: Aljaž Mur Eržen <[email protected]>
Date:   Tue May 30 12:47:38 2023 +0200

    Merge remote-tracking branch 'origin/main' into nulls-last

commit 6b474e8
Author: Maximilian Roos <[email protected]>
Date:   Wed May 24 13:57:19 2023 -0700

    .

commit 4441d84
Author: Maximilian Roos <[email protected]>
Date:   Wed May 24 13:22:32 2023 -0700

    .

commit 694ff47
Merge: e83d1fd7 2e03033
Author: Maximilian Roos <[email protected]>
Date:   Wed May 24 13:21:41 2023 -0700

    Merge branch 'main' into nulls-last

commit e83d1fd
Merge: 6959c5f 72f4998
Author: Maximilian Roos <[email protected]>
Date:   Wed May 24 01:56:09 2023 -0700

    Merge branch 'main' into nulls-last

commit 6959c5f
Merge: 9045353 eecee03
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 18:14:17 2023 -0700

    Merge branch 'main' into nulls-last

commit 9045353
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 18:14:00 2023 -0700

commit 94bd63b
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 17:55:29 2023 -0700

commit 40e1956
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 17:33:54 2023 -0700

commit 89c3a8a
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 16:30:56 2023 -0700

    Update website queries (great tests!!)

commit 4aeab70
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 12:01:40 2023 -0700

    MySQL also doesn't support it

commit 28d431c
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 11:57:01 2023 -0700

commit dd1ac9c
Author: Maximilian Roos <[email protected]>
Date:   Tue May 23 11:20:43 2023 -0700

    feat!: Default to `NULLS LAST`

    As discussed in PRQL#2601
@aljazerzen aljazerzen merged commit 967adb9 into PRQL:main May 30, 2023
@max-sixty
Copy link
Member Author

Until we decide, why merge? Possibly it's not technically a breaking change, but it's at least some churn.

I would favor reverting, releasing, and then continuing the discussion.

(Possibly I was keener on the change than you, so we're swapping positions here — arguably that's good!)

@aljazerzen
Copy link
Member

I just don't like open PRs that are accumulating merge conflicts :D

@max-sixty
Copy link
Member Author

OK, though I don't think that's the correct weighing of tradeoffs — churn in PRs is better than churn in our SQL output.

Even if we don't guarantee the sorted-ness of nulls, it's still going to change the output of some queries.

There are some parts of this we can keep, but until we make a decision would you object to reverting the bulk of it?

max-sixty added a commit to max-sixty/prql that referenced this pull request May 31, 2023
max-sixty added a commit that referenced this pull request May 31, 2023
max-sixty added a commit to max-sixty/prql that referenced this pull request May 31, 2023
max-sixty added a commit that referenced this pull request May 31, 2023
@aljazerzen
Copy link
Member

aljazerzen commented May 31, 2023

churn in our SQL output

Stability of produced SQL was never part of our versioning guarantees.

@max-sixty
Copy link
Member Author

Stability of produced SQL was never part of our versioning guarantees.

OK — but we surely still place some weight on the results that the query produces?

Possibly my reply of "SQL output" was unclear — I'm not worried about the SQL text per se — that has a very low weight in my mind. (We don't add random linebreaks! But otherwise...)

But if we went ahead with this, we'd have a note in our Changelog that says "Your queries will have different results because of the null sorting!", and then possibly another note next time stating "Actually we're back to the previous version!". Surely that seems bad — even if we don't guarantee null sorting (which isn't clear to me, but happy to accept it).

A curious aspect is I'm strongly mood-affiliated with your general perspective here! Move quickly, take some small pain to unblock the process, etc. But I I still place some weight on external churn. No?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants