Skip to content
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

fix: make nulls-order consistent with postgres #1344

Merged
merged 1 commit into from
Nov 20, 2021

Conversation

xudong963
Copy link
Member

Which issue does this PR close?

Closes #1343

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

No

@github-actions github-actions bot added datafusion Changes in the datafusion crate sql SQL Planner labels Nov 20, 2021
#[tokio::test]
async fn test_nulls_first_asc() -> Result<()> {
let mut ctx = ExecutionContext::new();
let sql = "SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three')) AS t (num,letter) ORDER BY num";
Copy link
Member Author

Choose a reason for hiding this comment

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

Every time I construct a test case with a value list, I think of @jimexist lol 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah it is so handy

@Dandandan
Copy link
Contributor

Dandandan commented Nov 20, 2021

Might be good to add some tests as well to compare it with PostgreSQL (integration-tests folder)?

@xudong963
Copy link
Member Author

Might be good to add some tests as well to compare it with PostgreSQL (integration-tests folder)?

OK

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I tried it out with postgres and indeed this appears consistent

alamb=# select * from A order by a;
 a 
---
 1
 2
  
(3 rows)

I agree with @Dandandan that some integration tests would be nice, though probably not necessary in this case

@xudong963
Copy link
Member Author

I tried it out with postgres and indeed this appears consistent

alamb=# select * from A order by a;
 a 
---
 1
 2
  
(3 rows)

I agree with @Dandandan that some integration tests would be nice, though probably not necessary in this case

Done, PTAL! cc @Dandandan

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks great to me. Thanks @xudong963

"| 1 | one |",
"+-----+--------+",
];
assert_batches_eq!(expected, &actual);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@houqp houqp added the bug Something isn't working label Nov 20, 2021
@Dandandan Dandandan merged commit 301e863 into apache:master Nov 20, 2021
@Dandandan
Copy link
Contributor

Thanks @xudong963 !

@xudong963 xudong963 deleted the fix_order branch November 21, 2021 02:13
@alamb
Copy link
Contributor

alamb commented Nov 22, 2021

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datafusion Changes in the datafusion crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NULLS ORDER is inconsistent with postgres
4 participants