-
Notifications
You must be signed in to change notification settings - Fork 3k
Spark: Spark SQL Extensions for create tag #6637
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: Spark SQL Extensions for create tag #6637
Conversation
|
In the original proposal, it was "[RETAIN For interval {DAYS | HOURS | MINUTES}]", but in keeping with CREATE BRANCH, I removed the" For" key. What do you think about that? @jackye1995 @amogh-jahagirdar |
|
Good point, +1 for only RETAIN because https://docs.databricks.com/sql/language-manual/delta-vacuum.html |
Ah yes, we should remove the FOR clause. That's a mistake in the proposal on my part. Updated the proposal. |
jackye1995
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.
Overall looks good to me, I will ignore the duplicated code and do another pass after rebase. Added 2 comments for discussion.
...sions/src/main/antlr/org.apache.spark.sql.catalyst.parser.extensions/IcebergSqlExtensions.g4
Outdated
Show resolved
Hide resolved
...sions/src/main/antlr/org.apache.spark.sql.catalyst.parser.extensions/IcebergSqlExtensions.g4
Outdated
Show resolved
Hide resolved
effe7e9 to
6b94b9c
Compare
|
@hililiwei similar to #6638 could this PR encapsulate create/replace? We came to the conclusion on the replaceBranch PR it made more sense to just combine them. at the end of the day the logical plan needs to pass through whether it's a replace or not and it is a bit more concise in the grammar definition to combine them while still maintaining readability |
+1 Let me know when this is updated, I will take another look! |
9d16516 to
8f73631
Compare
...sions/src/main/antlr/org.apache.spark.sql.catalyst.parser.extensions/IcebergSqlExtensions.g4
Outdated
Show resolved
Hide resolved
| ; | ||
|
|
||
| tagOptions | ||
| : (AS OF VERSION snapshotId)? (refRetain)?; |
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.
hmm I just noticed this ; in the end, also in branchOptions. @amogh-jahagirdar is this required? It doesn't feel like required to me.
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.
this is required. We can insert a new line, consistent with the rest.
| normalized.contains("replace branch") | ||
| normalized.contains("create branch") || | ||
| normalized.contains("replace branch") || | ||
| normalized.contains("create tag"))) |
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.
I think there is a fix for this at #6728 , might want to rebase after that is merged
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.
got it.
|
|
||
| /** | ||
| * Create an CREATE OR REPLACE BRANCH logical command. | ||
| */ |
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.
nice catches! But can we avoid unrelated changes in the PR? @amogh-jahagirdar I think you should fix these separately
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.
btw I am surprised that checkstyle did not catch that extra space, maybe it needs some more configuration.
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.
For scala, our checkstyle needs to be improved. And auto-formatting doesn't work yet.
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.
Great catch @hililiwei , I'll update #6728 to fix the styling issues. We should track an issue for scala checkstyle/autoformatting , admittedly I rely on that quite heavily to catch these kinds of issues.
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.
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.
Thanks, I merged #6728
|
Apart from the style changes for branch that can now be removed, I have no further comments. Let me know when this is rebased! |
...n/scala/org/apache/spark/sql/catalyst/parser/extensions/IcebergSqlExtensionsAstBuilder.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Amogh Jahagirdar <[email protected]> Co-authored-by: chidayong <[email protected]>
8a8c670 to
9dbdbed
Compare
03eacc8 to
3c60df2
Compare
3c60df2 to
f51effa
Compare
Misclick. 😂
PTAL, thx. |
jackye1995
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.
Mostly looks good to me! @amogh-jahagirdar @aokolnychyi any further comments?
| import org.junit.Test; | ||
| import org.junit.runners.Parameterized; | ||
|
|
||
| public class TestReplaceTag extends SparkExtensionsTestBase { |
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.
Can we move all the tag tests to TestTagDDL based on the discussion here #6752 (comment)? Not blocking for this PR we can get in a follow on, but it's basically just to ensure the test runs aren't super slow with all the spark setup which will happen for every test class if we have a test class per statement.
amogh-jahagirdar
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.
Thanks LiWei, one non-blocking comment on our test setup for all the branching/tagging DDLs. We can address on a follow on PR.
8da50f4 to
68c0353
Compare
yyanyy
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.
lgtm!
|
All the comments are addressed and we have enough votes, so I will go ahead to merge it. I requested @aokolnychyi for further review and approval, but given it has been quite a few days, and there is a subsequent DROP TAG PR anyway, we can move forward and address any missing comments there. Thanks for the contribution @hililiwei , and thanks everyone for the review! |
Co-authored-by: Amogh Jahagirdar <[email protected]> Co-authored-by: chidayong <[email protected]>
Co-authored-by: Amogh Jahagirdar [email protected]
Co-authored-by: chidayong [email protected]
What is the purpose of the change
Implement the syntax in the following documents:
https://docs.google.com/document/d/1tbATFPrKF3vNlzkgZQdaW8CAJmbjvryfrlg6C2Ci_aA/edit
Create TAG
e.g.
cc @jackye1995 @amogh-jahagirdar