Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b33aec4
Core, Data: File Format API interfaces
pvary Apr 11, 2025
5b79dbd
Renjie's comments
pvary Apr 29, 2025
a1daced
registerObjectModel exception handling fix
pvary Apr 30, 2025
79d7703
Removing the need for data.AppenderBuilder
pvary May 6, 2025
8404aa7
Fixed Renjie findings
pvary May 7, 2025
a00540d
Cosmentic changes
pvary May 15, 2025
2a4816a
Steven's comments
pvary May 19, 2025
ba16b59
ObjectModelRegistry->FileAccessFactory, and AppenederBuilder->WriteBu…
pvary May 20, 2025
9976bfb
Review comments by Steven and Russell (some javadoc, and a few method…
pvary May 21, 2025
62ea041
Added generic for the input/output of the reader/writer - like 'FileA…
pvary May 22, 2025
22ca3d7
New classes for implementation allows for absolutely new interfaces
pvary May 26, 2025
598f46d
Default methods for setting multiple config/meta values
pvary May 28, 2025
5ce49dc
Return FileReader instead of CloseableIterable from the ReadBuilder
pvary Jun 16, 2025
46a1742
Revert "Return FileReader instead of CloseableIterable from the ReadB…
pvary Jun 24, 2025
026e5e9
Ryan's comments
pvary Jun 24, 2025
3149874
Move interface classes to core
pvary Jun 25, 2025
4659adf
Rename FileAccessFactory to ObjectModelFactory
pvary Jun 25, 2025
40ec8bb
Ryan's next round of comments
pvary Jun 27, 2025
f20bb4e
Separate input conversion from witers
pvary Jul 22, 2025
7e91a40
Eduard's comments
pvary Jul 24, 2025
a957c47
Fixing parameter names
pvary Jul 24, 2025
8ce2f2e
Ryan's comments
pvary Aug 6, 2025
2b1b10b
Remove builder parameter from data file writers
pvary Aug 6, 2025
26e03b7
Remove parametrization as much as possible
pvary Aug 13, 2025
ef41daa
ContentFileWriteBuilder needs a generic parameter
pvary Aug 14, 2025
acb2254
Revert transformers, and used engine specific type setting for writer…
pvary Aug 25, 2025
3efd188
Steven's and Russel's comments
pvary Sep 11, 2025
e5611f4
Move to writeBuilder/positionDeleteWriteBuilder solution, and depreca…
pvary Sep 15, 2025
3a6a5ed
Use a specific FormatModel to write PositionDeletes
pvary Sep 24, 2025
fad5e07
Changes discussed on the sync
pvary Oct 2, 2025
790e282
Steven's comments
pvary Oct 8, 2025
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
@@ -0,0 +1,122 @@
/*
* 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.formats;

import java.nio.ByteBuffer;
import java.util.Map;
import org.apache.iceberg.MetricsConfig;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.SortOrder;
import org.apache.iceberg.StructLike;
import org.apache.iceberg.deletes.EqualityDeleteWriter;
import org.apache.iceberg.deletes.PositionDeleteWriter;
import org.apache.iceberg.encryption.EncryptionKeyMetadata;
import org.apache.iceberg.io.DataWriter;

/**
* A generic builder interface for creating specialized file writers in the Iceberg ecosystem.
*
* <p>This builder provides a unified configuration API for generating various types of content
* writers:
*
* <ul>
* <li>{@link DataWriter} for creating data files with table records
* <li>{@link EqualityDeleteWriter} for creating files with equality-based delete records
* <li>{@link PositionDeleteWriter} for creating files with position-based delete records
* </ul>
*
* <p>Each concrete implementation configures the underlying file format writer while adding
* content-specific metadata and behaviors.
*
* @param <B> the concrete builder type for method chaining
*/
interface ContentFileWriteBuilder<B extends ContentFileWriteBuilder<B>> {

/**
* Set a writer configuration property which affects the writer behavior.
*
* @param property a writer config property name
* @param value config value
* @return this for method chaining
*/
B set(String property, String value);

/**
* Adds the new properties to the writer configuration.
*
* @param properties a map of writer config properties
* @return this for method chaining
*/
default B setAll(Map<String, String> properties) {
properties.forEach(this::set);
return self();
}

/**
* Set a file metadata property in the created file.
*
* @param property a file metadata property name
* @param value config value
* @return this for method chaining
*/
B meta(String property, String value);

/**
* Add the new properties to file metadata for the created file.
*
* @param properties a map of file metadata properties
* @return this for method chaining
*/
default B meta(Map<String, String> properties) {
properties.forEach(this::meta);
return self();
}

/** Sets the metrics configuration used for collecting column metrics for the created file. */
B metricsConfig(MetricsConfig metricsConfig);

/** Overwrite the file if it already exists. By default, overwrite is disabled. */
B overwrite();

/**
* Sets the encryption key used for writing the file. If the writer does not support encryption,
* then an exception should be thrown.
*/
B withFileEncryptionKey(ByteBuffer encryptionKey);

/**
* Sets the additional authentication data (AAD) prefix used for writing the file. If the writer
* does not support encryption, then an exception should be thrown.
*/
B withAADPrefix(ByteBuffer aadPrefix);

/** Sets the partition specification for the Iceberg metadata. */
B spec(PartitionSpec newSpec);

/** Sets the partition value for the Iceberg metadata. */
B partition(StructLike partition);

/** Sets the encryption key metadata for Iceberg metadata. */
B keyMetadata(EncryptionKeyMetadata keyMetadata);

/** Sets the sort order for the Iceberg metadata. */
B sortOrder(SortOrder sortOrder);

B self();
}
Loading