Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ public static <T> ParquetValueWriter<T> buildWriter(
new WriteBuilder(type));
}

public static <T> ParquetValueWriter<T> buildWriter(
StructType dfSchema, MessageType type, Schema icebergSchema) {
return (ParquetValueWriter<T>)
ParquetWithSparkSchemaVisitor.visit(
dfSchema != null ? dfSchema : SparkSchemaUtil.convert(icebergSchema),
type,
new WriteBuilder(type));
}

private static class WriteBuilder extends ParquetWithSparkSchemaVisitor<ParquetValueWriter<?>> {
private final MessageType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
private StructType positionDeleteSparkType;
private final Schema positionDeleteRowSchema;
private final Table table;
private final FileFormat format;
private final FileFormat deleteFormat;
private final Map<String, String> writeProperties;

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = positionDeleteRowSchema;
this.positionDeleteSparkType = positionDeleteSparkType;
Expand Down Expand Up @@ -138,7 +138,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = null;
this.useDeprecatedPositionDeleteWriter = false;
Expand Down Expand Up @@ -172,7 +172,7 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
: MetricsConfig.forPositionDelete(table);

try {
return switch (format) {
return switch (deleteFormat) {
case AVRO ->
Avro.writeDeletes(file)
.createWriterFunc(
Expand Down Expand Up @@ -215,14 +215,13 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
.metricsConfig(metricsConfig)
.withPartition(partition)
.overwrite()
.metricsConfig(metricsConfig)
.rowSchema(positionDeleteRowSchema)
.withSpec(spec)
.withKeyMetadata(file.keyMetadata())
.buildPositionWriter();
default ->
throw new UnsupportedOperationException(
"Cannot write pos-deletes for unsupported file format: " + format);
"Cannot write pos-deletes for unsupported file format: " + deleteFormat);
};
} catch (IOException e) {
throw new UncheckedIOException("Failed to create new position delete writer", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ public static <T> ParquetValueWriter<T> buildWriter(
new WriteBuilder(type));
}

public static <T> ParquetValueWriter<T> buildWriter(
StructType dfSchema, MessageType type, Schema icebergSchema) {
return (ParquetValueWriter<T>)
ParquetWithSparkSchemaVisitor.visit(
dfSchema != null ? dfSchema : SparkSchemaUtil.convert(icebergSchema),
type,
new WriteBuilder(type));
}

private static class WriteBuilder extends ParquetWithSparkSchemaVisitor<ParquetValueWriter<?>> {
private final MessageType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
private StructType positionDeleteSparkType;
private final Schema positionDeleteRowSchema;
private final Table table;
private final FileFormat format;
private final FileFormat deleteFormat;
private final Map<String, String> writeProperties;

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = positionDeleteRowSchema;
this.positionDeleteSparkType = positionDeleteSparkType;
Expand Down Expand Up @@ -138,7 +138,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = null;
this.useDeprecatedPositionDeleteWriter = false;
Expand Down Expand Up @@ -172,7 +172,7 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
: MetricsConfig.forPositionDelete(table);

try {
return switch (format) {
return switch (deleteFormat) {
case AVRO ->
Avro.writeDeletes(file)
.createWriterFunc(
Expand Down Expand Up @@ -215,14 +215,13 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
.metricsConfig(metricsConfig)
.withPartition(partition)
.overwrite()
.metricsConfig(metricsConfig)
.rowSchema(positionDeleteRowSchema)
.withSpec(spec)
.withKeyMetadata(file.keyMetadata())
.buildPositionWriter();
default ->
throw new UnsupportedOperationException(
"Cannot write pos-deletes for unsupported file format: " + format);
"Cannot write pos-deletes for unsupported file format: " + deleteFormat);
};
} catch (IOException e) {
throw new UncheckedIOException("Failed to create new position delete writer", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ public static <T> ParquetValueWriter<T> buildWriter(
new WriteBuilder(type));
}

public static <T> ParquetValueWriter<T> buildWriter(
StructType dfSchema, MessageType type, Schema icebergSchema) {
return (ParquetValueWriter<T>)
ParquetWithSparkSchemaVisitor.visit(
dfSchema != null ? dfSchema : SparkSchemaUtil.convert(icebergSchema),
type,
new WriteBuilder(type));
}

private static class WriteBuilder extends ParquetWithSparkSchemaVisitor<ParquetValueWriter<?>> {
private final MessageType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
private StructType positionDeleteSparkType;
private final Schema positionDeleteRowSchema;
private final Table table;
private final FileFormat format;
private final FileFormat deleteFormat;
private final Map<String, String> writeProperties;

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = positionDeleteRowSchema;
this.positionDeleteSparkType = positionDeleteSparkType;
Expand Down Expand Up @@ -138,7 +138,7 @@ class SparkFileWriterFactory extends RegistryBasedFileWriterFactory<InternalRow,
useOrConvert(equalityDeleteSparkType, equalityDeleteRowSchema));

this.table = table;
this.format = dataFileFormat;
this.deleteFormat = deleteFileFormat;
this.writeProperties = writeProperties != null ? writeProperties : ImmutableMap.of();
this.positionDeleteRowSchema = null;
this.useDeprecatedPositionDeleteWriter = false;
Expand Down Expand Up @@ -172,7 +172,7 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
: MetricsConfig.forPositionDelete(table);

try {
return switch (format) {
return switch (deleteFormat) {
case AVRO ->
Avro.writeDeletes(file)
.createWriterFunc(
Expand Down Expand Up @@ -215,14 +215,13 @@ public PositionDeleteWriter<InternalRow> newPositionDeleteWriter(
.metricsConfig(metricsConfig)
.withPartition(partition)
.overwrite()
.metricsConfig(metricsConfig)
.rowSchema(positionDeleteRowSchema)
.withSpec(spec)
.withKeyMetadata(file.keyMetadata())
.buildPositionWriter();
default ->
throw new UnsupportedOperationException(
"Cannot write pos-deletes for unsupported file format: " + format);
"Cannot write pos-deletes for unsupported file format: " + deleteFormat);
};
} catch (IOException e) {
throw new UncheckedIOException("Failed to create new position delete writer", e);
Expand Down