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-46818][SQL] Improve error messages for Range with non-foldable inputs #44857

Closed

Conversation

allisonwang-db
Copy link
Contributor

@allisonwang-db allisonwang-db commented Jan 23, 2024

What changes were proposed in this pull request?

This PR improves the error messages for the Range function when the input arguments are not foldable.

Why are the changes needed?

To make error messages more user-friendly.
For example, before this PR, Spark throws an internal error:

SELECT * FROM range(0, (select 1));
[INTERNAL_ERROR] Cannot evaluate expression: scalar-subquery#1306 [] SQLSTATE: XX000

After this PR, the error message will be:

[NON_FOLDABLE_ARGUMENT] The function `range` requires the parameter `end` to be a foldable expression of the type "BIGINT", but the actual argument is a non-foldable. SQLSTATE: 42K08; line 1 pos 14

Does this PR introduce any user-facing change?

Yes. Error message improvement.

How was this patch tested?

New SQL tests.

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

No

@github-actions github-actions bot added the SQL label Jan 23, 2024
Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

Yes. Error message improvement.

@allisonwang-db Could you show the output after your changes.

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

Waiting for CI.

@allisonwang-db
Copy link
Contributor Author

@MaxGekk updated the PR description. The test failures do not seem to be related but I've retriggered them.

@MaxGekk
Copy link
Member

MaxGekk commented Jan 25, 2024

+1, LGTM. Merging to master.
Thank you, @allisonwang-db.

@MaxGekk MaxGekk closed this in c3872cd Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants