-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: RewriteDatafilesAction V2 #2591
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
955fd38
Spark: RewriteDatafilesAction V2
RussellSpitzer a0261e1
Refactor Execute Method
RussellSpitzer f295dce
SetID -> GroupID
RussellSpitzer 2c41966
Missed SpecID reference
RussellSpitzer 7c1c611
Adds more tests
RussellSpitzer c40816a
Add tests for failure modes
RussellSpitzer 6562dfd
More Cleanup and Reviewer Comments
RussellSpitzer 0d27400
Handle changes in refactoring of RewriteDatafiles
RussellSpitzer 844aac5
Refactor out common variables into container classes
RussellSpitzer c6b9cfd
Further encapsulation and refactoring
RussellSpitzer eaaa529
Checkstyle
RussellSpitzer e9d3a98
Checkstyle
RussellSpitzer 3b96656
More Reviewer Comments
RussellSpitzer b03fd70
Expliclty try to shut down rewrite service
RussellSpitzer decad9e
Reviewer Comments
RussellSpitzer 72887d1
Adjust job description
RussellSpitzer 12b1695
Update based on some tests
RussellSpitzer fe8a2f4
Additional Reviewer Comments
RussellSpitzer 557c6a2
Remove unused import
RussellSpitzer cc57cf2
Refactor state out of Action into Strategy
RussellSpitzer eddf2da
Refactor CommitService out of Action and into Core
RussellSpitzer da80b52
Cleanup of code
RussellSpitzer f27e551
Remove Extra Paren
RussellSpitzer cb1999d
Reviewer Comments
RussellSpitzer d87eea8
Reviewer Comments
RussellSpitzer cae6ad3
Fix up more comments
RussellSpitzer 6dca1c0
Typo
RussellSpitzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
core/src/main/java/org/apache/iceberg/actions/BaseFileGroupRewriteResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.iceberg.actions; | ||
|
||
import org.apache.iceberg.actions.RewriteDataFiles.FileGroupInfo; | ||
import org.apache.iceberg.actions.RewriteDataFiles.FileGroupRewriteResult; | ||
|
||
public class BaseFileGroupRewriteResult implements FileGroupRewriteResult { | ||
private final int addedDataFilesCount; | ||
private final int rewrittenDataFilesCount; | ||
private final FileGroupInfo info; | ||
|
||
public BaseFileGroupRewriteResult(FileGroupInfo info, int addedFilesCount, int rewrittenFilesCount) { | ||
this.info = info; | ||
this.addedDataFilesCount = addedFilesCount; | ||
this.rewrittenDataFilesCount = rewrittenFilesCount; | ||
} | ||
|
||
@Override | ||
public FileGroupInfo info() { | ||
return info; | ||
} | ||
|
||
@Override | ||
public int addedDataFilesCount() { | ||
return addedDataFilesCount; | ||
} | ||
|
||
@Override | ||
public int rewrittenDataFilesCount() { | ||
return rewrittenDataFilesCount; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
core/src/main/java/org/apache/iceberg/actions/BaseRewriteDataFilesFileGroupInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.iceberg.actions; | ||
|
||
import org.apache.iceberg.StructLike; | ||
import org.apache.iceberg.relocated.com.google.common.base.MoreObjects; | ||
|
||
public class BaseRewriteDataFilesFileGroupInfo implements RewriteDataFiles.FileGroupInfo { | ||
private final int globalIndex; | ||
private final int partitionIndex; | ||
private final StructLike partition; | ||
|
||
public BaseRewriteDataFilesFileGroupInfo(int globalIndex, int partitionIndex, StructLike partition) { | ||
this.globalIndex = globalIndex; | ||
this.partitionIndex = partitionIndex; | ||
this.partition = partition; | ||
} | ||
|
||
@Override | ||
public int globalIndex() { | ||
return globalIndex; | ||
} | ||
|
||
@Override | ||
public int partitionIndex() { | ||
return partitionIndex; | ||
} | ||
|
||
@Override | ||
public StructLike partition() { | ||
return partition; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this) | ||
.add("globalIndex", globalIndex) | ||
.add("partitionIndex", partitionIndex) | ||
.add("partition", partition) | ||
.toString(); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
core/src/main/java/org/apache/iceberg/actions/BaseRewriteDataFilesResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.iceberg.actions; | ||
|
||
import java.util.List; | ||
import org.apache.iceberg.actions.RewriteDataFiles.FileGroupRewriteResult; | ||
import org.apache.iceberg.actions.RewriteDataFiles.Result; | ||
|
||
public class BaseRewriteDataFilesResult implements Result { | ||
private final List<FileGroupRewriteResult> rewriteResults; | ||
|
||
public BaseRewriteDataFilesResult(List<FileGroupRewriteResult> rewriteResults) { | ||
this.rewriteResults = rewriteResults; | ||
} | ||
|
||
@Override | ||
public List<FileGroupRewriteResult> rewriteResults() { | ||
return rewriteResults; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need to override
equals
andhashCode
as this is used in the result map?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.
Yes, we will need the override
equals
andhashCode
because I see we will use thisinfo
as keys in a HashMap.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.
Not sure what do o here for equals and hashcode, since we can't get those for a StructLike without a Struct and at this point we don't have them. I'd be fine with changing the interface to just be a list of Pairs instead of key/value (or some new result type which has file group embedded)
Like
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 assume this is no longer used in maps?