-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-54412][SQL][TEST] Clean up v properly in identifier-clause.sql SQL golden file
#53121
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
Conversation
|
@srielau and @cloud-fan Please review. |
|
In my local environment |
| WITH identifier('v')(identifier('c1')) AS (VALUES(1)) (SELECT c1 FROM v); | ||
| CREATE OR REPLACE VIEW v(IDENTIFIER('c1')) AS VALUES(1); | ||
| SELECT c1 FROM v; | ||
| DROP VIEW v; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| DROP VIEW v; | |
| DROP VIEW IF EXISTS v; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird. Why could this be needed) There is something else hiding here. Unless the test files are executed in parallel. In that case we have a bigger problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh never mind.. The DROP VIEW was missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloud-fan I don't think that IF EXIST is preferred in this case
- view is created just 2 lines above
- if
create viewerrors out, it is expected thatselectanddropwould also error out - all
drop viewin this file do not useIF EXIST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is to not let DROP VIEW error out. It's just for cleanup the test resource, there is no point to test its error behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not matter here if DROP VIEW v errors out or not. The goal is to cleanup and if the view does not exist (in the legacy case), both SELECT and DROP would error out consistently. The error does not affect anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error gets committed into the golden file...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same for SELECT one line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleanup code should be as less noisy as possible. Maybe we should have a clear separation between testing code and cleanup code in the golden file test framework, so that we don't commit anything for the cleanup code in the golden file. The SELECT one line above is clearly a testing code.
Thanks @dongjoon-hyun for quickly addressing this issue properly!
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @vrozov . It would be great if you can address @cloud-fan 's comment if you want to move forward.
DROP VIEW v; to identifier-clause* SQL golden files
DROP VIEW v; to identifier-clause* SQL golden filesv properly in identifier-clause* SQL golden files
v properly in identifier-clause* SQL golden filesv properly in identifier-clause.sql SQL golden file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @vrozov , @cloud-fan , @srielau .
As a release manager, I made an alternative PR while keeping @vrozov 's authorship to unblock this PR's review process by showing @vrozov what was @cloud-fan 's review comment. Actually, it's @cloud-fan 's code in the review comment, but I respected @vrozov 's analysis and finding this bug.
….sql` SQL golden file ### What changes were proposed in this pull request? This PR aims to clean up `v` properly in `identifier-clause.sql` SQL golden file. Note that this is originated from #53121 with the original authorship although the code is changed [according to the community review comment](#53121 (comment)). ### Why are the changes needed? Due to the lack of a proper clean-up, this causes flaky test failures ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53121 Closes #53176 from dongjoon-hyun/SPARK-54412-2. Authored-by: Vlad Rozov <vrozov@amazon.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 12bce6b) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
|
Hi @dongjoon-hyun and @cloud-fan, Please explain how this DROP VIEW v; is different from DROP VIEW test_view;? The later one causes the same error and it is (unnecessary) clean up code as well. I think the error in the legacy case does not affect anything, and it is not obvious, is hard to maintain without extra comments or looking into |
|
@vrozov I've explained the reasoning in #53121 (comment) , if you don't agree, we can discuss more but I don't think it worth the time. If you agree but you found some places not following it, feel free to fix them. |
What changes were proposed in this pull request?
Drop view
vinidentifier-clause.sqlWhy are the changes needed?
After #52765 view
vis created and it is necessary to cleanup this view to avoid conflictsDoes this PR introduce any user-facing change?
No
How was this patch tested?
updated golden files and run the test
Was this patch authored or co-authored using generative AI tooling?
No