You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/03 23:10:08 UTC

[GitHub] [pinot] dd-willgan opened a new issue, #8832: PinotClientTransport package private

dd-willgan opened a new issue, #8832:
URL: https://github.com/apache/pinot/issues/8832

   Hi, I'm trying to use the Pinot Java Client (recommended over the JDBC client for production) with authentication by instantiating a [JsonAsyncHttpClientTransportFactory](https://github.com/apache/pinot/blob/master/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java) and setting the headers / scheme to HTTPS, and afterwards calling `buildTransport()` and using [ConnectionFactory.fromHostList](https://github.com/apache/pinot/blob/release-0.10.0/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ConnectionFactory.java#L126). A code snippet of this is shown below
   
   ```
   String brokerUrl = "<broker-url>";
   String username = "<username>";
   String password = "<password>";
   String query = "select * from baseball_stats limit 10";
   
   // Add Basic Auth header to connection
   String encoding = Base64.getEncoder().encodeToString((username + ":" + password).getBytes());
   Map<String, String> headers = Collections.singletonMap("Authorization", "Basic " + encoding);
   
   // Build transport for HTTPS
   JsonAsyncHttpPinotClientTransportFactory factory =
       new JsonAsyncHttpPinotClientTransportFactory();
   factory.setHeaders(headers);
   factory.setScheme("https");
   
   // Establish connection
   Connection conn = ConnectionFactory.fromHostList(
       Collections.singletonList(brokerUrl),
       factory.buildTransport());
   
   // Issue query
   Request pinotClientRequest = new Request("sql", query);
   ResultSetGroup pinotResultSetGroup = conn.execute(pinotClientRequest);
   
   // Extract results
   ResultSet resultTableResultSet = pinotResultSetGroup.getResultSet(0);
   System.out.println(resultTableResultSet.toString());
   ```
   
   `buildTransport()` returns a `PinotClientTransport` interface and that's what `ConnectionFactory.fromHostList` takes in as argument as well. However, since [PinotClientTransport is not explicitly public i.e. package private](https://github.com/apache/pinot/blob/release-0.10.0/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/PinotClientTransport.java#L27), the `PinotClientTransport` type can't be referenced. This is not a problem in the code snippet above / in Java but leads to errors in Kotlin. Can this interface be made public?


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


[GitHub] [pinot] Jackie-Jiang closed issue #8832: PinotClientTransport package private

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang closed issue #8832: PinotClientTransport package private
URL: https://github.com/apache/pinot/issues/8832


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