Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package org.apache.parquet.hadoop;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
Expand All @@ -34,7 +36,30 @@ public class InterOpTester {
private static final String PARQUET_TESTING_REPO = "https://github.com/apache/parquet-testing/raw/";
private static final String PARQUET_TESTING_PATH = "target/parquet-testing/";
private static final Logger LOG = LoggerFactory.getLogger(InterOpTester.class);
private OkHttpClient httpClient = new OkHttpClient();
// since PARQUET_TESTING_REPO might be beyond a web proxy ...
private static OkHttpClient createOkHttpClientOptProxy() {
/* We use a different JVM property set,
* because CI may define JVM properties
* "https.proxyHost" and "https.proxyPort"
* and that proxy won't support some compressions
* (e.g. gzip/snappy on github.com CI).
/
String proxyHost = System.getProperty("parquet.https.proxyHost");
String proxyPort = System.getProperty("parquet.https.proxyPort");
OkHttpClient client = null;
if (proxyHost != null || proxyPort != null) {
try {
int port = Integer.valueOf(proxyPort);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, port));
client = new OkHttpClient.Builder().proxy(proxy).build();
} catch (NumberFormatException e) {
}
}
if (client == null) client = new OkHttpClient();
return client;
}

private OkHttpClient httpClient = createOkHttpClientOptProxy();

public Path GetInterOpFile(String fileName, String changeset) throws IOException {
return GetInterOpFile(fileName, changeset, "data");
Expand Down