rdblue commented on code in PR #4537: URL: https://github.com/apache/iceberg/pull/4537#discussion_r898265357
########## core/src/main/java/org/apache/iceberg/puffin/Puffin.java: ########## @@ -0,0 +1,97 @@ +/* + * 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.puffin; + +import java.util.Map; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; + +public final class Puffin { + private Puffin() { + } + + public static WriteBuilder write(OutputFile outputFile) { + return new WriteBuilder(outputFile); + } + + public static class WriteBuilder { + private final OutputFile outputFile; + private final Map<String, String> properties = Maps.newLinkedHashMap(); + private boolean compressFooter = false; + private PuffinCompressionCodec defaultBlobCompression = PuffinCompressionCodec.NONE; + + private WriteBuilder(OutputFile outputFile) { + this.outputFile = outputFile; + } + + public WriteBuilder set(String property, String value) { + properties.put(property, value); + return this; + } + + public WriteBuilder setAll(Map<String, String> props) { + this.properties.putAll(props); + return this; + } + + public WriteBuilder compressFooter() { + this.compressFooter = true; + return this; + } + + public WriteBuilder compressBlobs(PuffinCompressionCodec compression) { + this.defaultBlobCompression = compression; + return this; + } + + public PuffinWriter build() { + return new PuffinWriter(outputFile, properties, compressFooter, defaultBlobCompression); Review Comment: Why not set it automatically? It seems weird to require writers to remember to add it themselves. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
