pvary commented on code in PR #12298: URL: https://github.com/apache/iceberg/pull/12298#discussion_r2002938197
########## core/src/main/java/org/apache/iceberg/io/datafile/WriteBuilder.java: ########## @@ -0,0 +1,268 @@ +/* + * 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.io.datafile; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import org.apache.iceberg.FileFormat; +import org.apache.iceberg.MetricsConfig; +import org.apache.iceberg.PartitionSpec; +import org.apache.iceberg.Schema; +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; +import org.apache.iceberg.io.DeleteSchemaUtil; +import org.apache.iceberg.io.FileAppender; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; +import org.apache.iceberg.util.ArrayUtil; + +/** + * Builder implementation for generating the different writer interfaces. The builder is an internal + * class and could change without notice. Use one of the following specific interfaces: + * + * <ul> + * <li>{@link FileAppender} + * <li>{@link DataWriter} + * <li>{@link EqualityDeleteWriter} + * <li>{@link PositionDeleteWriter} + * </ul> + * + * The builder wraps the file format specific {@link DataFileAppenderBuilder}. To allow further + * engine and file format specific configuration changes for the given writer the {@link + * DataFileAppenderBuilder#build(DataFileAppenderBuilder.WriteMode)} method is called with the + * correct parameter to create the appender used internally to provide the required functionality. + * + * @param <A> type of the appender + * @param <E> engine specific schema of the input records used for appender initialization + */ +@SuppressWarnings("unchecked") +class WriteBuilder<B extends WriteBuilder<B, A, E>, A extends DataFileAppenderBuilder<A, E>, E> Review Comment: This is again an interesting question. We have 2 different apis here: 1. APIs implemented by the file formats - currently in the `core` module and in the `org.apache.iceberg.io` package 2. APIs used by the data file readers and writers - currently in the `data` module in the `org.apache.iceberg.data` package The `ReadBuilder` is an exception, because it is implemented by the file format, but directly exposed to the readers. I was considering creating a wrapper around it to decouple the two. I decided against it, because I don't see any direct current benefit from it and it makes harder to expose the `SupportsDeleteFilter` api through the 2 interfaces. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org