Skip to content

Conversation

@hililiwei
Copy link
Contributor

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]>
@github-actions github-actions bot added the spark label Feb 11, 2023
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a 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 thanks @hililiwei ! Just some test cases I think we can clean up

Assert.assertEquals(first, ref.snapshotId());
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also have a test to ensure that DROP TAG does not work when the ref is a branch. If I missed the opposite case for DROP BRANCH, I think let's add that as well for completeness.

Comment on lines +281 to +285
AssertHelpers.assertThrows(
"Non-conforming tag name",
IcebergParseException.class,
"mismatched input '123'",
() -> sql("ALTER TABLE %s DROP TAG %s", tableName, "123"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine to include this test but could we separate it and have this test just focused on the happy case?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

sql("ALTER TABLE %s DROP TAG %s", tableName, tagName);
table.refresh();
ref = table.refs().get(tagName);
Assert.assertNull(ref);
Copy link
Contributor

@jackye1995 jackye1995 Feb 13, 2023

Choose a reason for hiding this comment

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

nit: we should prefer to add a description for all the assertions, there are many assertEquals and assertNull here that lack description

@jackye1995
Copy link
Contributor

Overall looks good to me, just some nit comments about the tests

Comment on lines 78 to +79
| ALTER TABLE multipartIdentifier DROP BRANCH (IF EXISTS)? identifier #dropBranch
| ALTER TABLE multipartIdentifier DROP TAG (IF EXISTS)? identifier #dropTag
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be written like :

Suggested change
| ALTER TABLE multipartIdentifier DROP BRANCH (IF EXISTS)? identifier #dropBranch
| ALTER TABLE multipartIdentifier DROP TAG (IF EXISTS)? identifier #dropTag
| ALTER TABLE multipartIdentifier DROP (BRANCH | TAG) (IF EXISTS)? identifier #dropBranchOrTag

Copy link
Contributor

@jackye1995 jackye1995 Feb 14, 2023

Choose a reason for hiding this comment

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

we discussed this in #6637 (comment), and the conclusion was that it is more clear to have them separated.

The current way for separated DROP BRANCH and DROP TAG makes the logic consistent with CREATE.

Let me know what you think!

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, was mostly coming from spark code base, considering this example :

https://github.com/apache/spark/blob/46a234125d3f125ba1f9ccd6af0ec1ba61016c1e/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4#L125

If we have reached the concencus, then it should be fine.

…l/catalyst/plans/logical/DropTag.scala

Co-authored-by: Prashant Singh <[email protected]>
@jackye1995
Copy link
Contributor

Restart CI

@jackye1995 jackye1995 closed this Feb 14, 2023
@jackye1995 jackye1995 reopened this Feb 14, 2023
Copy link
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

looks good to me!

Copy link
Contributor

@yyanyy yyanyy left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks @hililiwei for the contribution!

Copy link
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks @hililiwei !

Comment on lines 78 to +79
| ALTER TABLE multipartIdentifier DROP BRANCH (IF EXISTS)? identifier #dropBranch
| ALTER TABLE multipartIdentifier DROP TAG (IF EXISTS)? identifier #dropTag
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, was mostly coming from spark code base, considering this example :

https://github.com/apache/spark/blob/46a234125d3f125ba1f9ccd6af0ec1ba61016c1e/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4#L125

If we have reached the concencus, then it should be fine.

…park/extensions/TestBranchDDL.java

Co-authored-by: Amogh Jahagirdar <[email protected]>
@jackye1995
Copy link
Contributor

Looks like we have all comments addressed, I will go ahead to merge the PR. Thanks for the contribution @hililiwei , and thanks for everyone's review!

@jackye1995 jackye1995 merged commit 72adc7c into apache:master Feb 14, 2023
@hililiwei
Copy link
Contributor Author

Thank you all for review 😄

krvikash pushed a commit to krvikash/iceberg that referenced this pull request Mar 16, 2023
Co-authored-by: Amogh Jahagirdar <[email protected]>
Co-authored-by: chidayong <[email protected]>
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.

5 participants