xndai commented on code in PR #17457: URL: https://github.com/apache/iceberg/pull/17457#discussion_r3754832124
########## core/src/main/java/org/apache/iceberg/io/http/HttpUrlSupport.java: ########## @@ -0,0 +1,200 @@ +/* + * 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.http; + +import java.io.Serializable; +import java.net.URI; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import org.apache.hc.client5.http.config.ConnectionConfig; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.core5.io.CloseMode; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.metrics.MetricsContext; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.util.PropertyUtil; +import org.apache.iceberg.util.SerializableMap; + +/** + * A helper that a {@link org.apache.iceberg.io.FileIO} can delegate to for reading a file directly + * over HTTP(S) instead of its normal, credentialed read path. + * + * <p>Intended for catalogs that vend a pre-signed object-store URL directly as a file's location + * (e.g. a scan task's {@code file-path}). The location is used unchanged as the fetch URL, so + * {@link InputFile#location()} equals the location passed to {@link #newInputFile(String, + * MetricsContext)}. + * + * <p>The underlying HTTP client's timeouts and connection pool are configurable through the + * properties passed to {@link #HttpUrlSupport(Map)}. When a setting is not provided, the client + * falls back to JVM system properties and then to the Apache HttpClient defaults. + */ +public class HttpUrlSupport implements Serializable { Review Comment: I find this class name a bit strange. Can we just call it HttpUrlClient, or HttpUrlHelper? -- 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]
