kishoreg commented on a change in pull request #5988:
URL: https://github.com/apache/incubator-pinot/pull/5988#discussion_r484699665



##########
File path: 
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotDriver.java
##########
@@ -37,16 +38,18 @@
 public class PinotDriver implements Driver {
   private static final org.slf4j.Logger LOGGER = 
LoggerFactory.getLogger(PinotDriver.class);
   private final String SCHEME = "pinot";
+  public static final String TENANT = "tenant";
 
   @Override
   public Connection connect(String url, Properties info)
       throws SQLException {
     try {
       LOGGER.info("Initiating connection to database for url: " + url);
       PinotClientTransport pinotClientTransport = new 
JsonAsyncHttpPinotClientTransportFactory().buildTransport();
-      List<String> brokerList = DriverUtils.getBrokersFromURL(url);
       String controllerUrl = DriverUtils.getControllerFromURL(url);
-      return new PinotConnection(brokerList, controllerUrl, 
pinotClientTransport);
+      Preconditions.checkArgument(info.containsKey(TENANT), "Pinot tenant 
missing in the properties");

Review comment:
       not needed, you can use the default tenant name and go with it. 

##########
File path: 
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/PinotControllerTransport.java
##########
@@ -77,13 +76,31 @@ public SchemaResponse getTableSchema(String table, String 
controllerAddress) {
       final Future<Response> response =
           requestBuilder.addHeader("Content-Type", "application/json; 
charset=utf-8").execute();
 
-      SchemaResponseFuture schemaResponseFuture = new 
SchemaResponseFuture(response, url);
+      SchemaResponse.SchemaResponseFuture schemaResponseFuture = new 
SchemaResponse.SchemaResponseFuture(response, url);
       return schemaResponseFuture.get();
     } catch (ExecutionException e) {
       throw new PinotClientException(e);
     }
   }
 
+  public ControllerTenantBrokerResponse getBrokersFromController(String 
controllerAddress, String tenant) {

Review comment:
       is this called for every connection creation or every query?

##########
File path: 
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/response/ControllerTenantBrokerResponse.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client.controller.response;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectReader;
+import com.google.common.collect.Lists;
+import com.ning.http.client.Response;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+
+public class ControllerTenantBrokerResponse {
+  private JsonNode _brokers;
+
+  private ControllerTenantBrokerResponse() {
+
+  }
+
+  private ControllerTenantBrokerResponse(JsonNode 
controllerTenantBrokerResponse) {
+    _brokers = controllerTenantBrokerResponse;
+  }
+
+  public static ControllerTenantBrokerResponse fromJson(JsonNode 
controllerTenantBrokerResponse) {
+    return new ControllerTenantBrokerResponse(controllerTenantBrokerResponse);
+  }
+
+  public static ControllerTenantBrokerResponse empty() {
+    return new ControllerTenantBrokerResponse();
+  }
+
+  public List<String> getBrokers() {
+    List<String> brokerList = new ArrayList<>();
+
+    for (JsonNode broker : _brokers) {
+      String[] brokerPath = broker.textValue().split("_");

Review comment:
       better to get the host name port from instance config instead of the 
broker name




----------------------------------------------------------------
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.

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