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

[SPARK-51303] [SQL] [TESTS] Extend ORDER BY testing coverage #50069

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mihailoale-db
Copy link
Contributor

@mihailoale-db mihailoale-db commented Feb 24, 2025

What changes were proposed in this pull request?

I propose that we extend order-by-all.sql and DataFrameSuite.scala and add order-by.sql which extend the coverage of ORDER BY feature.

Why are the changes needed?

In order to catch potential bugs.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Feb 24, 2025
@@ -0,0 +1,24 @@
-- Test data.
CREATE OR REPLACE TEMPORARY VIEW testData AS SELECT * FROM VALUES
Copy link
Contributor

Choose a reason for hiding this comment

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

You should drop this view at the end of the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't do that in any of the tests. @MaxGekk why is that?

AS testData(a, b);

-- ORDER BY a column from a child's output
SELECT a FROM testData ORDER BY a;
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably have these simple test cases somewhere already? I would be surprised if we don't.

SELECT a, (SELECT b FROM testData GROUP BY b HAVING b > 1 ORDER BY a) FROM testData;

-- Column resolution from the child's output takes the precedence over `ORDER BY ALL`
SELECT a, (SELECT b FROM VALUES (1, 2) AS innerTestData (all, b) ORDER BY ALL) FROM testData;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in order-by-all.sql, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't resolve it as ALL keyword but as a column, that's why I put it here.

@mihailoale-db
Copy link
Contributor Author

@MaxGekk Could you PTAL when you have time? Thanks

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

Successfully merging this pull request may close these issues.

2 participants