You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "avshenuk (via GitHub)" <gi...@apache.org> on 2025/07/17 06:36:40 UTC

[PR] Small fixes in Java clients [pinot]

avshenuk opened a new pull request, #16366:
URL: https://github.com/apache/pinot/pull/16366

   Issue 1: https://github.com/apache/pinot/issues/16259
   Issue 2: https://github.com/apache/pinot/issues/11313#issuecomment-3053518446


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "avshenuk (via GitHub)" <gi...@apache.org>.
avshenuk commented on PR #16366:
URL: https://github.com/apache/pinot/pull/16366#issuecomment-3083368104

   A few tests failed due to:
   ```
   java.sql.SQLException: Failed to execute query : SELECT 1 from nonExistingTable LIMIT 1000000
   
   	at org.apache.pinot.client.PinotStatement.executeQuery(PinotStatement.java:75)
   	at org.apache.pinot.integration.tests.OfflineClusterIntegrationTest.testNonExistingTableQueryThroughJDBCClient(OfflineClusterIntegrationTest.java:3860)
   	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
   	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:687)
   	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
   	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
   	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:995)
   	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
   	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
   	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
   	at org.testng.TestRunner.privateRun(TestRunner.java:741)
   	at org.testng.TestRunner.run(TestRunner.java:616)
   	at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
   	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
   	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
   	at org.testng.SuiteRunner.run(SuiteRunner.java:312)
   	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
   	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
   	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
   	at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
   	at org.testng.TestNG.runSuites(TestNG.java:1112)
   	at org.testng.TestNG.run(TestNG.java:1079)
   	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
   	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)
   Caused by: org.apache.pinot.client.PinotClientException: Could not find broker to query with no tables
   ```
   
   I've added a fallback mechanism similar to what was already done in DynamicBrokerSelector: choose a random broker if none is found for a given table.
   Since the assumption seems to be that such a query should just return an empty result, and not fail with an exception.


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "avshenuk (via GitHub)" <gi...@apache.org>.
avshenuk commented on PR #16366:
URL: https://github.com/apache/pinot/pull/16366#issuecomment-3083115838

   Fixed failing tests too.


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "avshenuk (via GitHub)" <gi...@apache.org>.
avshenuk commented on code in PR #16366:
URL: https://github.com/apache/pinot/pull/16366#discussion_r2212658871


##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -94,11 +94,25 @@ public ResultSetGroup execute(String query) {
    */
   public ResultSetGroup execute(@Nullable String tableName, String query)
       throws PinotClientException {
-    String[] tableNames = (tableName == null) ? resolveTableName(query) : new String[]{tableName};
-    String brokerHostPort = _brokerSelector.selectBroker(tableNames);
+    return execute(tableName == null ? null : List.of(tableName), query);
+  }
+
+  /**
+   * Executes a query.
+   *
+   * @param tableNames Names of all the tables to execute the query on
+   * @param query The query to execute
+   * @return The result of the query
+   * @throws PinotClientException If an exception occurs while processing the query
+   */
+  public ResultSetGroup execute(@Nullable Iterable<String> tableNames, String query)
+      throws PinotClientException {
+    String[] resultTableNames =
+        (tableNames == null) ? resolveTableName(query) : Iterables.toArray(tableNames, String.class);
+    String brokerHostPort = _brokerSelector.selectBroker(resultTableNames);
     if (brokerHostPort == null) {
       throw new PinotClientException("Could not find broker to query " + ((tableNames == null) ? "with no tables"
-          : "for table(s): " + Arrays.asList(tableNames)));
+          : "for table(s): " + tableNames));

Review Comment:
   Fixed



##########
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnection.java:
##########
@@ -59,13 +58,12 @@ public class PinotConnection extends AbstractBaseConnection {
     } else {
       _controllerTransport = controllerTransport;
     }
-    List<String> brokers;
     if (properties.containsKey(BROKER_LIST)) {
-      brokers = Arrays.asList(properties.getProperty(BROKER_LIST).split(";"));
+      List<String> brokers = Arrays.asList(properties.getProperty(BROKER_LIST).split(";"));

Review Comment:
   Fixed



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang merged PR #16366:
URL: https://github.com/apache/pinot/pull/16366


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #16366:
URL: https://github.com/apache/pinot/pull/16366#discussion_r2212544953


##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -94,11 +94,25 @@ public ResultSetGroup execute(String query) {
    */
   public ResultSetGroup execute(@Nullable String tableName, String query)
       throws PinotClientException {
-    String[] tableNames = (tableName == null) ? resolveTableName(query) : new String[]{tableName};
-    String brokerHostPort = _brokerSelector.selectBroker(tableNames);
+    return execute(tableName == null ? null : List.of(tableName), query);
+  }
+
+  /**
+   * Executes a query.
+   *
+   * @param tableNames Names of all the tables to execute the query on
+   * @param query The query to execute
+   * @return The result of the query
+   * @throws PinotClientException If an exception occurs while processing the query
+   */
+  public ResultSetGroup execute(@Nullable Iterable<String> tableNames, String query)
+      throws PinotClientException {
+    String[] resultTableNames =
+        (tableNames == null) ? resolveTableName(query) : Iterables.toArray(tableNames, String.class);
+    String brokerHostPort = _brokerSelector.selectBroker(resultTableNames);
     if (brokerHostPort == null) {
       throw new PinotClientException("Could not find broker to query " + ((tableNames == null) ? "with no tables"
-          : "for table(s): " + Arrays.asList(tableNames)));
+          : "for table(s): " + tableNames));

Review Comment:
   Concatenating an Iterable directly may not produce a readable list of table names if the Iterable implementation doesn't override toString. Consider using Iterables.toString(tableNames) or String.join to format the names explicitly.



##########
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnection.java:
##########
@@ -59,13 +58,12 @@ public class PinotConnection extends AbstractBaseConnection {
     } else {
       _controllerTransport = controllerTransport;
     }
-    List<String> brokers;
     if (properties.containsKey(BROKER_LIST)) {
-      brokers = Arrays.asList(properties.getProperty(BROKER_LIST).split(";"));
+      List<String> brokers = Arrays.asList(properties.getProperty(BROKER_LIST).split(";"));

Review Comment:
   Splitting the broker list on ';' may produce empty strings if there are trailing semicolons. Consider filtering out empty entries to avoid passing invalid broker addresses.
   ```suggestion
         List<String> brokers = Arrays.stream(properties.getProperty(BROKER_LIST).split(";"))
             .filter(broker -> !broker.isEmpty())
             .toList();
   ```



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Small fixes in Java clients [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16366:
URL: https://github.com/apache/pinot/pull/16366#issuecomment-3083329246

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/16366?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 56.36%. Comparing base [(`1a476de`)](https://app.codecov.io/gh/apache/pinot/commit/1a476dea72ebf1c15e14ded28ae60c385f71b2c3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`f1528db`)](https://app.codecov.io/gh/apache/pinot/commit/f1528dbb93fa3080ba39f619fecf67c11fc0d2fd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 462 commits behind head on master.
   
   > :exclamation:  There is a different number of reports uploaded between BASE (1a476de) and HEAD (f1528db). Click for more details.
   > 
   > <details><summary>HEAD has 68 uploads less than BASE</summary>
   >
   >| Flag | BASE (1a476de) | HEAD (f1528db) |
   >|------|------|------|
   >|java-21|10|1|
   >|unittests|6|1|
   >|unittests1|3|1|
   >|skip-bytebuffers-true|4|0|
   >|temurin|15|1|
   >|unittests2|3|0|
   >|skip-bytebuffers-false|8|0|
   >|java-11|5|0|
   >|integration|9|0|
   >|integration2|3|0|
   >|integration1|3|0|
   >|custom-integration1|3|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #16366      +/-   ##
   ============================================
   - Coverage     62.90%   56.36%   -6.54%     
   + Complexity     1386      699     -687     
   ============================================
     Files          2867     2320     -547     
     Lines        163354   128276   -35078     
     Branches      24952    20438    -4514     
   ============================================
   - Hits         102755    72305   -30450     
   + Misses        52847    50000    -2847     
   + Partials       7752     5971    -1781     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.36% <ø> (-6.46%)` | :arrow_down: |
   | [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.36% <ø> (-6.54%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.36% <ø> (-6.54%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.36% <ø> (+0.54%)` | :arrow_up: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/16366/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/16366?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org