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

feat: Error when a SHOW command is passed in with an accompanying non-existant variable #11540

Merged
merged 5 commits into from
Jul 22, 2024
Merged

Conversation

itsjunetime
Copy link
Contributor

Which issue does this PR close?

Closes #11529

Rationale for this change

This is a very simple implementation for the change suggested in #11529, and is easy to review and comprehend.

What changes are included in this PR?

This causes datafusion to return an error when someone attempts to execute a command that contains a SHOW statement whose variable does not exist in the information_schema.df_settings table. This provides a better UX for the user, as they get told exactly what's going on (with a clear error) when they execute this command, instead of getting an empty table as the result (which was happening previously).

Are these changes tested?

Yes - Additions were made to the sqllogictest tests to cover the use case addressed here.

Are there any user-facing changes?

I think this counts as a user-facing change - it would be easy to rely on the behavior of "SHOW will return an empty result if doesn't exist" and so it's very possible someone does rely on that.

I'd be happy to update documentation if that's necessary with this change, though I'm somewhat uncertain as to whether this warrants that - the previous behavior wasn't specified in docs, so I don't know if it is necessary here. It probably couldn't hurt, I think.

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Jul 19, 2024
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.

Thank you @itsjunetime, this looks like a very nice improvement to me

The CI failure looks unrelated to this PR and I have retriggered it

https://github.com/apache/datafusion/actions/runs/10011021548/job/27673684873?pr=11540

---- fuzz_cases::join_fuzz::test_anti_join_1k_filtered stdout ----
thread 'fuzz_cases::join_fuzz::test_anti_join_1k_filtered' panicked at datafusion/core/tests/fuzz_cases/join_fuzz.rs:537:17:
assertion `left == right` failed: HashJoinExec and SortMergeJoinExec produced different row counts, batch_size: 1
  left: 970
 right: 971
stack backtrace:

I also saw the same error on another PR so I will file a ticket: #11527 (comment)

@alamb
Copy link
Contributor

alamb commented Jul 19, 2024

Filed #11555

@alamb alamb merged commit 47d5d1f into apache:main Jul 22, 2024
23 checks passed
@alamb
Copy link
Contributor

alamb commented Jul 22, 2024

Thanks again @itsjunetime

Lordworms pushed a commit to Lordworms/arrow-datafusion that referenced this pull request Jul 23, 2024
…-existant variable (apache#11540)

* feat: Error when a SHOW command is passed in with an accompanying non-existant variable

* fix: Run fmt

* Switch to 'query error' instead of 'statement error' in sqllogictest test to see if that fixes CI

* Move some errors in sqllogictest to line above to maybe fix CI

* Fix (hopefully final) failing information_schema slt test due to multiline error message/placement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SHOW NONSENSE does not error
2 participants