rdblue commented on a change in pull request #87: Add LocationProvider to determine data file locations. URL: https://github.com/apache/incubator-iceberg/pull/87#discussion_r254410229
########## File path: api/src/main/java/com/netflix/iceberg/io/LocationProvider.java ########## @@ -0,0 +1,49 @@ +/* + * 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 com.netflix.iceberg.io; + +import com.netflix.iceberg.PartitionSpec; +import com.netflix.iceberg.StructLike; +import java.io.Serializable; + +/** + * Interface for providing data file locations to write tasks. + * <p> + * Implementations must be {@link Serializable} because instances will be serialized to tasks. + */ +public interface LocationProvider extends Serializable { Review comment: The provider expects a filename so that engines can pass context in the file name. Flink and Spark add context to the file path. Spark, for example, uses the partition number, the task attempt ID, and a UUID that will correspond to the Spark query UUID. That way, we can trace data back to specific tasks and Spark ensures that its attempt files don't conflict. We (Matt and I) tried different variations of this that accepted metadata and we think that this is the cleanest and most flexible approach because the data passed to the location provider isn't limited to data in the table. The TableOperations that returns a LocationProvider can configure it using any table data or external data. That way, we don't have to keep updating the interface with new metadata that a particular implementation needs. The LocationProvider is created and configured by TableOperations at the time a new write needs one. `metadataFileLocation` is handled separately because it doesn't need to be publicly exposed. We may move it eventually, but I want to keep this commit small. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
