-
Notifications
You must be signed in to change notification settings - Fork 3.5k
API, Core, Spark, Flink: add version-agnostic Snapshot.rootLocation() #17523
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
Open
stevenzwu
wants to merge
2
commits into
apache:main
Choose a base branch
from
stevenzwu:snapshot_file_extract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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,32 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| /** | ||
| * A file that may be encrypted. If it is encrypted, its encrypted key metadata is tracked in the | ||
| * table metadata encryption keys and is referenced by a key ID. | ||
| */ | ||
| public interface FileWithKeyId { | ||
|
|
||
| /** Location of the file. */ | ||
| String location(); | ||
|
|
||
| /** Returns the encryption key ID for this file, or null if the file is not encrypted. */ | ||
| String keyId(); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -136,13 +136,13 @@ protected CloseableIterable<FileScanTask> doPlanFiles() { | |
| Iterables.transform( | ||
| filteredSnapshots, | ||
| snap -> { | ||
| if (snap.manifestListLocation() != null) { | ||
| if (snap.rootLocation() != null) { | ||
| return new ManifestListReadTask( | ||
| dataTableSchema, | ||
| io, | ||
| schema(), | ||
| specs, | ||
| new BaseManifestListFile(snap.manifestListLocation(), snap.keyId()), | ||
| new BaseFileWithKeyId(snap.rootLocation(), snap.keyId()), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I missed this in the "generic interface" PR. Already covered there, might worth another rebase with that. |
||
| residual, | ||
| snap.snapshotId()); | ||
| } else { | ||
|
|
@@ -165,7 +165,7 @@ static class ManifestListReadTask implements DataTask { | |
| private final FileIO io; | ||
| private final Schema schema; | ||
| private final Map<Integer, PartitionSpec> specs; | ||
| private final ManifestListFile manifestList; | ||
| private final FileWithKeyId manifestList; | ||
| private final Expression residual; | ||
| private final long referenceSnapshotId; | ||
| private DataFile lazyDataFile = null; | ||
|
|
@@ -175,7 +175,7 @@ static class ManifestListReadTask implements DataTask { | |
| FileIO io, | ||
| Schema schema, | ||
| Map<Integer, PartitionSpec> specs, | ||
| ManifestListFile manifestList, | ||
| FileWithKeyId manifestList, | ||
| Expression residual, | ||
| long referenceSnapshotId) { | ||
| this.dataTableSchema = dataTableSchema; | ||
|
|
@@ -276,7 +276,7 @@ Map<Integer, PartitionSpec> specsById() { | |
| return specs; | ||
| } | ||
|
|
||
| ManifestListFile manifestList() { | ||
| FileWithKeyId manifestList() { | ||
| return manifestList; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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
41 changes: 41 additions & 0 deletions
41
core/src/main/java/org/apache/iceberg/BaseFileWithKeyId.java
This file contains hidden or 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,41 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| class BaseFileWithKeyId implements FileWithKeyId, Serializable { | ||
| private final String location; | ||
| private final String keyId; | ||
|
|
||
| BaseFileWithKeyId(String location, String encryptionKeyID) { | ||
| this.location = location; | ||
| this.keyId = encryptionKeyID; | ||
| } | ||
|
|
||
| @Override | ||
| public String location() { | ||
| return location; | ||
| } | ||
|
|
||
| @Override | ||
| public String keyId() { | ||
| return keyId; | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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.
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.
Not entirely sure we should default to a deprecated function. Can't we throw UOE and let the implementation override this?