Skip to content

Conversation

@namrathamyske
Copy link
Contributor

@namrathamyske namrathamyske commented Jun 9, 2022

Issue addressed from: #3896

This PR contains the Implementation part from #4926 for only Append to Table operation.

Changes addressed:

  1. Code to update to a branch.
  2. Fetching the parent snapshot in the branch so as to make changes only to the specific branch.
  3. Similarly fetching manifests from parent snapshot in a specific branch.

nkeshavaprakash added 2 commits June 9, 2022 13:22
Append changes to snapshot branch - changes after review comments

remove space

Adding support methods for supporting performing append/delete on branch

Removing spaces

Removing spaces

Removing unwanted vars

Adding check for null and invalid branch

Adding check for null and invalid branch
@namrathamyske namrathamyske changed the title Append changes to branch Impl (contd from https://github.com/apache/iceberg/pull/4926) Append changes to branch Impl Jun 9, 2022
@namrathamyske
Copy link
Contributor Author

@amogh-jahagirdar @rdblue Here are the implementation changes as addressed in #4926 (comment)

@namrathamyske namrathamyske changed the title Append changes to branch Impl Core, API: Append changes to branch Impl Jun 9, 2022
@namrathamyske
Copy link
Contributor Author

@jackye1995 Is it possible for you to review this?

cc: @SreeramGarlapati

@namrathamyske
Copy link
Contributor Author

@amogh-jahagirdar incorporated your feedback. Thanks for your review.

@namrathamyske namrathamyske changed the title Core, API: Append changes to branch Impl Core, API: Append/Delete changes to branch Impl Jun 20, 2022
@namrathamyske
Copy link
Contributor Author

@rdblue Can you review this ?

@namrathamyske
Copy link
Contributor Author

namrathamyske commented Jun 21, 2022

@amogh-jahagirdar Thanks for your review ! Incorporated the changes requested.

@namrathamyske namrathamyske changed the title Core, API: Append/Delete changes to branch Impl Core, API: Append to branch Impl Jul 9, 2022
@namrathamyske
Copy link
Contributor Author

namrathamyske commented Jul 9, 2022

@rdblue @amogh-jahagirdar I have implemented toBranch method only for Append operations as per suggestion in #4926 (comment). For other operations it will throw an UnsupportedOperationException. Please let me know if this looks good? Can be merged only after #4926

fixing tests

add new ref

Removing unncessary methods

spell checks

spell checks
@namrathamyske
Copy link
Contributor Author

namrathamyske commented Jul 10, 2022

@rdblue @amogh-jahagirdar After appending to a branch, The sequence number for main ref is continued from last number from branch ref. Should the sequence number continue from last last commit in main ref or branch ref ? Any thoughts appreciated.

If the sequence number is continued from branch ref, the linearity is broken. But if we continue from main ref, we will have snapshots with same sequence number.


@Override
public ThisT toBranch(String branch) {
throw new UnsupportedOperationException("Performing operations on a branch is currently not supported");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the error wording looks a bit confusing to me. Are we planning to support the toBranch method in this class later or is it not envisioned to be supported on this particular class at all? thx!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dimas-b , In the PR i have implemented the toBranch only in one of the subclasses of Snapshot producer aka FastAppend class. This is done in order to avoid creating a huge PR and be thorough in testing each of the child operations of snapshot producer. In future my aim is to incrementally raise PR for each of them.

Copy link
Contributor

@dimas-b dimas-b Jul 11, 2022

Choose a reason for hiding this comment

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

Thanks for the clarification, @namrathamyske ! Would you mind updating the message to something like Performing SnapshotProducer operations on a branch is currently not supported to avoid making a (false) impression that it is not supported in "general"?.. or use different wording as you see fit. My only concern is that getting the old message in one context might be interpreted that it is not supported anywhere.


@Override
public FastAppend toBranch(String branch) {
Preconditions.checkArgument(branch != null, "branch cannot be null");
Copy link
Contributor

Choose a reason for hiding this comment

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

Message should be Invalid branch name: null

public FastAppend toBranch(String branch) {
Preconditions.checkArgument(branch != null, "branch cannot be null");
if (ops.current().ref(branch) == null) {
super.createNewRef(branch);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be handled by SnapshotProducer, as I noted on #4926.


Preconditions.checkArgument(ops.current()
.ref(branch).type()
.equals(SnapshotRefType.BRANCH),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this check need to be split across 3 lines? Or is that autoformatting doing it?

Preconditions.checkArgument(ops.current()
.ref(branch).type()
.equals(SnapshotRefType.BRANCH),
"%s is not a ref to type branch", branch);
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar Aug 3, 2022

Choose a reason for hiding this comment

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

Also now that we're creating a branch if it doesn't exist, on commit, we should do a null check. It's okay if the branch is null, since we'll create it. if it's not null, it must be an actual branch. I think this should also reside in snapshot producer as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants