danielcweeks commented on code in PR #8303: URL: https://github.com/apache/iceberg/pull/8303#discussion_r1300285135
########## azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java: ########## @@ -0,0 +1,197 @@ +/* + * 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.azure.adlsv2; + +import com.azure.core.http.HttpClient; +import com.azure.core.util.Context; +import com.azure.storage.file.datalake.DataLakeFileClient; +import com.azure.storage.file.datalake.DataLakeFileSystemClient; +import com.azure.storage.file.datalake.DataLakeFileSystemClientBuilder; +import com.azure.storage.file.datalake.models.ListPathsOptions; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.iceberg.azure.AzureProperties; +import org.apache.iceberg.common.DynConstructors; +import org.apache.iceberg.io.BulkDeletionFailureException; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.io.FileInfo; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.io.SupportsBulkOperations; +import org.apache.iceberg.io.SupportsPrefixOperations; +import org.apache.iceberg.metrics.MetricsContext; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; +import org.apache.iceberg.util.SerializableMap; +import org.apache.iceberg.util.Tasks; +import org.apache.iceberg.util.ThreadPools; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** FileIO implementation backed by Azure Data Lake Storage Gen2. */ +public class ADLSFileIO implements FileIO, SupportsBulkOperations, SupportsPrefixOperations { + + private static final Logger LOG = LoggerFactory.getLogger(ADLSFileIO.class); + private static final String DEFAULT_METRICS_IMPL = + "org.apache.iceberg.hadoop.HadoopMetricsContext"; + + private static final HttpClient HTTP = HttpClient.createDefault(); + + private AzureProperties azureProperties; + private MetricsContext metrics = MetricsContext.nullMetrics(); + private SerializableMap<String, String> properties = null; + + /** + * No-arg constructor to load the FileIO dynamically. + * + * <p>All fields are initialized by calling {@link ADLSFileIO#initialize(Map)} later. + */ + public ADLSFileIO() {} + + @VisibleForTesting + ADLSFileIO(AzureProperties azureProperties) { + this.azureProperties = azureProperties; + } + + @Override + public InputFile newInputFile(String path) { + return ADLSInputFile.of(path, fileClient(path), azureProperties, metrics); Review Comment: nit: using `ADLSInputFile.of(...)` feels a little strange. The other FileIO implementations appear to use `fromLocation` or `fromPath`). -- 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]
