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

noob-se7en pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 5419dfd750b Fix Pinot client scheme property merge (#18607)
5419dfd750b is described below

commit 5419dfd750bf7c88031684868ad8286519fb936e
Author: Cc <[email protected]>
AuthorDate: Fri Jun 5 04:08:21 2026 +0800

    Fix Pinot client scheme property merge (#18607)
    
    Co-authored-by: wolfkill <[email protected]>
---
 .../JsonAsyncHttpPinotClientTransportFactory.java  |  6 ++--
 .../JsonAsyncHttpPinotClientTransportTest.java     | 33 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git 
a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
 
b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
index 3471796d284..1e2c2a90ba3 100644
--- 
a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
+++ 
b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
@@ -85,9 +85,9 @@ public class JsonAsyncHttpPinotClientTransportFactory 
implements PinotClientTran
       _headers = ConnectionUtils.getHeadersFromProperties(properties);
     }
 
-    String scheme = properties.getProperty("scheme", 
CommonConstants.HTTP_PROTOCOL);
-    if (_scheme == null || !_scheme.contentEquals(scheme)) {
-      _scheme = scheme;
+    _scheme = properties.getProperty("scheme", _scheme);
+    if (_scheme == null) {
+      _scheme = CommonConstants.HTTP_PROTOCOL;
     }
 
     if (_sslContext == null && 
_scheme.contentEquals(CommonConstants.HTTPS_PROTOCOL)) {
diff --git 
a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportTest.java
 
b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportTest.java
index a211cdf8b76..bb6058c5a4a 100644
--- 
a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportTest.java
+++ 
b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportTest.java
@@ -30,6 +30,7 @@ import java.net.InetSocketAddress;
 import java.util.Properties;
 import java.util.concurrent.CompletableFuture;
 import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.pinot.spi.utils.CommonConstants;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
@@ -140,6 +141,38 @@ public class JsonAsyncHttpPinotClientTransportTest 
implements HttpHandler {
     }
   }
 
+  @Test
+  public void 
withConnectionPropertiesRetainsConfiguredSchemeWhenSchemePropertyIsAbsent() {
+    JsonAsyncHttpPinotClientTransportFactory factory = new 
JsonAsyncHttpPinotClientTransportFactory();
+    factory.setScheme(CommonConstants.HTTPS_PROTOCOL);
+
+    factory.withConnectionProperties(new Properties());
+
+    assertEquals(factory.getScheme(), CommonConstants.HTTPS_PROTOCOL);
+  }
+
+  @Test
+  public void 
withConnectionPropertiesOverridesConfiguredSchemeWhenSchemePropertyIsPresent() {
+    JsonAsyncHttpPinotClientTransportFactory factory = new 
JsonAsyncHttpPinotClientTransportFactory();
+    factory.setScheme(CommonConstants.HTTP_PROTOCOL);
+    Properties connectionProps = new Properties();
+    connectionProps.setProperty("scheme", CommonConstants.HTTPS_PROTOCOL);
+
+    factory.withConnectionProperties(connectionProps);
+
+    assertEquals(factory.getScheme(), CommonConstants.HTTPS_PROTOCOL);
+  }
+
+  @Test
+  public void 
withConnectionPropertiesFallsBackToHttpWhenConfiguredSchemeIsNull() {
+    JsonAsyncHttpPinotClientTransportFactory factory = new 
JsonAsyncHttpPinotClientTransportFactory();
+    factory.setScheme(null);
+
+    factory.withConnectionProperties(new Properties());
+
+    assertEquals(factory.getScheme(), CommonConstants.HTTP_PROTOCOL);
+  }
+
   // Cursor-related tests
   @Test
   public void testExecuteQueryWithCursor() {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to