Jackie-Jiang commented on code in PR #9902:
URL: https://github.com/apache/pinot/pull/9902#discussion_r1038441723


##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -165,7 +163,33 @@ public Future<ResultSetGroup> executeAsync(String query)
   @Deprecated
   public Future<ResultSetGroup> executeAsync(Request request)
       throws PinotClientException {
-    return executeAsync(request.getQuery());
+    return executeAsync(null, request.getQuery());
+  }
+
+  /**
+   * Executes a query asynchronously.
+   *
+   * @param query The query to execute
+   * @return A future containing the result of the query
+   * @throws PinotClientException If an exception occurs while processing the 
query
+   */
+  public Future<ResultSetGroup> executeAsync(String tableName, String query)
+      throws PinotClientException {
+    tableName = tableName == null ? resolveTableName(query) : tableName;
+    String brokerHostPort = _brokerSelector.selectBroker(tableName);
+    if (brokerHostPort == null) {
+      throw new PinotClientException("Could not find broker to query for 
statement: " + query);
+    }
+    return new 
ResultSetGroupFuture(_transport.executeQueryAsync(brokerHostPort, query));
+  }
+
+  private static String resolveTableName(String query) {

Review Comment:
   ```suggestion
     @Nullable
     private static String resolveTableName(String query) {
   ```



##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -165,7 +163,33 @@ public Future<ResultSetGroup> executeAsync(String query)
   @Deprecated
   public Future<ResultSetGroup> executeAsync(Request request)
       throws PinotClientException {
-    return executeAsync(request.getQuery());
+    return executeAsync(null, request.getQuery());
+  }
+
+  /**
+   * Executes a query asynchronously.
+   *
+   * @param query The query to execute
+   * @return A future containing the result of the query
+   * @throws PinotClientException If an exception occurs while processing the 
query
+   */
+  public Future<ResultSetGroup> executeAsync(String tableName, String query)

Review Comment:
   ```suggestion
     public Future<ResultSetGroup> executeAsync(@Nullable String tableName, 
String query)
   ```



##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -165,7 +163,33 @@ public Future<ResultSetGroup> executeAsync(String query)
   @Deprecated
   public Future<ResultSetGroup> executeAsync(Request request)
       throws PinotClientException {
-    return executeAsync(request.getQuery());
+    return executeAsync(null, request.getQuery());
+  }
+
+  /**
+   * Executes a query asynchronously.
+   *
+   * @param query The query to execute
+   * @return A future containing the result of the query
+   * @throws PinotClientException If an exception occurs while processing the 
query
+   */
+  public Future<ResultSetGroup> executeAsync(String tableName, String query)
+      throws PinotClientException {
+    tableName = tableName == null ? resolveTableName(query) : tableName;
+    String brokerHostPort = _brokerSelector.selectBroker(tableName);
+    if (brokerHostPort == null) {
+      throw new PinotClientException("Could not find broker to query for 
statement: " + query);
+    }
+    return new 
ResultSetGroupFuture(_transport.executeQueryAsync(brokerHostPort, query));
+  }
+
+  private static String resolveTableName(String query) {
+    try {
+      return 
CalciteSqlCompiler.compileToBrokerRequest(query).querySource.tableName;
+    } catch (Exception e) {
+      LOGGER.error("Cannot parse table name from query: " + query, e);

Review Comment:
   ```suggestion
         LOGGER.error("Cannot parse table name from query: {}", query, e);
   ```



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to