https://github.com/reactiverse/pinot-client
This client exposes the Pinot Java Client for Eclipse Vert.x applications.
https://github.com/reactiverse/pinot-client
Last synced: 6 months ago
JSON representation
This client exposes the Pinot Java Client for Eclipse Vert.x applications.
- Host: GitHub
- URL: https://github.com/reactiverse/pinot-client
- Owner: reactiverse
- License: apache-2.0
- Created: 2023-05-17T21:11:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T12:46:09.000Z (over 2 years ago)
- Last Synced: 2025-03-02T08:20:39.346Z (11 months ago)
- Language: Java
- Size: 69.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pinot-client
Vert.x Pinot client exposes a convenient API for Eclipse Vert.x applications to query Apache Pinot servers.
The client is built atop the official [pinot-java-client](https://docs.pinot.apache.org/users/clients/java).
## Install
Using maven:
```
io.reactiverse
pinot-client
1.0-SNAPSHOT
```
Using Gradle:
```
implementation("io.reactiverse:pinot-client:1.0-SNAPSHOT")
```
## Sample usage
Initialize the transport and the client:
```java
String brokerUrl = "localhost:8000";
VertxPinotClientTransport transport = new VertxPinotClientTransport(vertx);
VertxConnection connection = VertxConnectionFactory.fromHostList(vertx, List.of(brokerUrl), transport);
```
Here is a sample usage with Java API where we ask to retrieve a list of top 10 players with most home runs:
```java
String query = "select playerName, sum(homeRuns) AS totalHomeRuns from baseballStats where homeRuns > 0 group by playerID, playerName ORDER BY totalHomeRuns DESC limit 10";
connection
.execute(query)
.onSuccess(resultSetGroup -> {
ResultSet results = resultSetGroup.getResultSet(0);
System.out.println("Player Name\tTotal Home Runs");
for (int i = 0; i < results.getRowCount(); i++) {
System.out.println(results.getString(i, 0) + "\t" + results.getString(i, 1));
}
})
.onFailure(Throwable::printStackTrace);
```
And here is the RxJava 2 API equivalent:
```java
String query = "select playerName, sum(homeRuns) AS totalHomeRuns from baseballStats where homeRuns > 0 group by playerID, playerName ORDER BY totalHomeRuns DESC limit 10";
connection
.rxExecute(query)
.subscribe(resultSetGroup -> {
ResultSet results = resultSetGroup.getResultSet(0);
System.out.println("Player Name\tTotal Home Runs");
for (int i = 0; i < results.getRowCount(); i++) {
System.out.println(results.getString(i, 0) + "\t" + results.getString(i, 1));
}
}, Throwable::printStackTrace);
```
You can configure the underlying webclient options while creating the Vert.x transport. For instance, here is how an
example of configuring timeouts on the web client transport:
```java
WebClientOptions options = new WebClientOptions()
.setConnectTimeout(15000)
.setIdleTimeout(15000)
.setKeepAliveTimeout(15000);
VertxPinotClientTransport transport = new VertxPinotClientTransport(vertx, Map.of(), "http", null, options);
```