Skip to content

Commit 54bc501

Browse files
committed
Spark: Fix duplicate method call
1 parent dde0dc2 commit 54bc501

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkFileWriterFactory.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
6060
private StructType positionDeleteSparkType;
6161
private final Schema positionDeleteRowSchema;
6262
private final Table table;
63-
private final FileFormat format;
63+
private final FileFormat deleteFormat;
6464
private final Map<String, String> writeProperties;
6565

6666
/**
@@ -100,7 +100,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
100100
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));
101101

102102
this.table = table;
103-
this.format = dataFileFormat;
103+
this.deleteFormat = deleteFileFormat;
104104
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
105105
this.positionDeleteRowSchema = positionDeleteRowSchema;
106106
this.positionDeleteSparkType = positionDeleteSparkType;
@@ -138,7 +138,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
138138
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));
139139

140140
this.table = table;
141-
this.format = dataFileFormat;
141+
this.deleteFormat = deleteFileFormat;
142142
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
143143
this.positionDeleteRowSchema = null;
144144
this.useDeprecatedPositionDeleteWriter = false;
@@ -172,7 +172,7 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
172172
: MetricsConfig.forPositionDelete(table);
173173

174174
try {
175-
return switch (format) {
175+
return switch (deleteFormat) {
176176
case AVRO ->
177177
Avro.writeDeletes(file)
178178
.createWriterFunc(
@@ -215,14 +215,13 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
215215
.metricsConfig(metricsConfig)
216216
.withPartition(partition)
217217
.overwrite()
218-
.metricsConfig(metricsConfig)
219218
.rowSchema(positionDeleteRowSchema)
220219
.withSpec(spec)
221220
.withKeyMetadata(file.keyMetadata())
222221
.buildPositionWriter();
223222
default ->
224223
throw new UnsupportedOperationException(
225-
"Cannot write pos-deletes for unsupported file format: " + format);
224+
"Cannot write pos-deletes for unsupported file format: " + deleteFormat);
226225
};
227226
} catch (IOException e) {
228227
throw new UncheckedIOException("Failed to create new position delete writer", e);

0 commit comments

Comments
 (0)