This is an automated email from the ASF dual-hosted git repository.

Fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-java.git


The following commit(s) were added to refs/heads/master by this push:
     new c7e7acbd4 GH-3482: parquet-hadoop tests to work behind a web proxy 
(#3483)
c7e7acbd4 is described below

commit c7e7acbd463178039ec29bcfafe41f91c6a4d65b
Author: alexeyroytman <[email protected]>
AuthorDate: Tue May 12 21:33:04 2026 +0300

    GH-3482: parquet-hadoop tests to work behind a web proxy (#3483)
    
    * parquet-hadoop tests to work behind a web proxy
    
    * parquet-hadoop to use separate JVM propertied not to clash with existing 
CI
    
    * syntax fix
    
    * parquet-hadoop: another test provisioned to run behind a web proxy
    
    * safer condition, catching NPE at InterOpTester.java
    
    * better proxy misconfig diagnostic for testing
    
    offered by Copilot
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
---
 .../org/apache/parquet/hadoop/InterOpTester.java   | 34 +++++++++++++++++++++-
 .../parquet/hadoop/TestInteropBloomFilter.java     |  2 +-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git 
a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/InterOpTester.java 
b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/InterOpTester.java
index 2618fcb21..cdd40300a 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/InterOpTester.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/InterOpTester.java
@@ -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;
@@ -34,7 +36,37 @@ 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 ...
+  public 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) {
+        LOG.warn(
+            "Ignoring proxy configuration because proxy port could not be 
parsed: "
+                + "parquet.https.proxyHost='{}', parquet.https.proxyPort='{}'. 
"
+                + "Falling back to a direct connection.",
+            proxyHost,
+            proxyPort,
+            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");
diff --git 
a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInteropBloomFilter.java
 
b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInteropBloomFilter.java
index 5b7ae6a85..66e86ce2b 100644
--- 
a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInteropBloomFilter.java
+++ 
b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInteropBloomFilter.java
@@ -57,7 +57,7 @@ public class TestInteropBloomFilter {
   private static String DATA_INDEX_BLOOM_WITH_LENGTH_FILE = 
"data_index_bloom_encoding_with_length.parquet";
 
   private static final Logger LOG = 
LoggerFactory.getLogger(TestInteropBloomFilter.class);
-  private OkHttpClient httpClient = new OkHttpClient();
+  private OkHttpClient httpClient = InterOpTester.createOkHttpClientOptProxy();
 
   @Test
   public void testReadDataIndexBloomParquetFiles() throws IOException {

Reply via email to