Skip to content

Commit c6afe2f

Browse files
authored
[Kernel][#3] Refactoring - following up with a missed refactor (delta-io#4775)
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md 2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP] Your PR title ...'. 3. Be sure to keep the PR description updated to reflect all changes. 4. Please write your PR title to summarize what this PR proposes. 5. If possible, provide a concise example to reproduce the issue for a faster review. 6. If applicable, include the corresponding issue number in the PR title and link it in the body. --> #### Which Delta project/connector is this regarding? <!-- Please add the component selected below to the beginning of the pull request title For example: [Spark] Title of my pull request --> - [ ] Spark - [ ] Standalone - [ ] Flink - [x] Kernel - [ ] Other (fill in here) ## Description <!-- - Describe what this PR changes. - Describe why we need the change. If this PR resolves an issue be sure to include "Resolves #XXX" to correctly link and close the issue upon merge. --> Follow up to delta-io#4734 and removes a missed function definition during refactoring. ## How was this patch tested? <!-- If tests were added, say they were added here. Please make sure to test the changes thoroughly including negative and positive cases if possible. If the changes were tested in any way other than unit tests, please clarify how you tested step by step (ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future). If the changes were not tested, please explain why. --> Unit tests. ## Does this PR introduce _any_ user-facing changes? <!-- If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible. If possible, please also clarify if this is a user-facing change compared to the released Delta Lake versions or within the unreleased branches such as master. If no, write 'No'. --> No
1 parent 1f99118 commit c6afe2f

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

kernel/kernel-api/src/main/java/io/delta/kernel/internal/icebergcompat/IcebergWriterCompatV1MetadataValidatorAndUpdater.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
import static java.util.stream.Collectors.toSet;
2121

2222
import io.delta.kernel.exceptions.KernelException;
23-
import io.delta.kernel.internal.DeltaErrors;
2423
import io.delta.kernel.internal.TableConfig;
2524
import io.delta.kernel.internal.actions.Metadata;
2625
import io.delta.kernel.internal.actions.Protocol;
2726
import io.delta.kernel.internal.tablefeatures.TableFeature;
28-
import io.delta.kernel.internal.util.ColumnMapping;
29-
import io.delta.kernel.internal.util.SchemaIterable;
3027
import io.delta.kernel.types.*;
3128
import java.util.*;
3229
import java.util.stream.Stream;
@@ -151,41 +148,6 @@ public static Optional<Metadata> validateAndUpdateIcebergWriterCompatV1Metadata(
151148
TYPE_WIDENING_RW_PREVIEW_FEATURE)
152149
.collect(toSet());
153150

154-
/**
155-
* Checks that in the schema column mapping is set up such that the physicalName is equal to
156-
* "col-[fieldId]". This check assumes column mapping is enabled (and so should be performed after
157-
* that check).
158-
*/
159-
private static final IcebergCompatCheck PHYSICAL_NAMES_MATCH_FIELD_IDS_CHECK =
160-
(inputContext) -> {
161-
List<String> invalidFields =
162-
new SchemaIterable(inputContext.newMetadata.getSchema())
163-
.stream()
164-
// ID info is only on struct fields.
165-
.filter(SchemaIterable.SchemaElement::isStructField)
166-
.filter(
167-
element -> {
168-
StructField field = element.getField();
169-
String physicalName = ColumnMapping.getPhysicalName(field);
170-
long columnId = ColumnMapping.getColumnId(field);
171-
return !physicalName.equals(String.format("col-%s", columnId));
172-
})
173-
.map(
174-
element -> {
175-
StructField field = element.getField();
176-
return String.format(
177-
"%s(physicalName='%s', columnId=%s)",
178-
element.getNamePath(),
179-
ColumnMapping.getPhysicalName(field),
180-
ColumnMapping.getColumnId(field));
181-
})
182-
.collect(toList());
183-
184-
if (!invalidFields.isEmpty()) {
185-
throw DeltaErrors.icebergWriterCompatInvalidPhysicalName(invalidFields);
186-
}
187-
};
188-
189151
@Override
190152
String compatFeatureName() {
191153
return "icebergWriterCompatV1";

0 commit comments

Comments
 (0)