Expand description
Applications can use this rust client library to query Apache Pinot.
§Usage
§Create a Pinot Connection
Pinot client could be initialized through:
- Zookeeper Path.
let client = pinot_client_rust::connection::client_from_zookeeper(
&pinot_client_rust::zookeeper::ZookeeperConfig::new(
vec!["localhost:2181".to_string()],
"/PinotCluster".to_string(),
),
None
);
- A list of broker addresses.
- For HTTP Default scheme is HTTP if not specified.
let client = pinot_client_rust::connection::client_from_broker_list(
vec!["localhost:8099".to_string()], None);
- For HTTPS Scheme is required to be part of the URI.
let client = pinot_client_rust::connection::client_from_broker_list(
vec!["https://localhost:8099".to_string()], None);
§Asynchronous Queries
An asynchronous connection can be established with
pinot_client_rust::async_connection::AsyncConnection
for which exist equivalents to the above
described synchronous instantiation methods.
§Example Pinot Query
let client = pinot_client_rust::connection::client_from_broker_list(
vec!["localhost:8099".to_string()], None).unwrap();
let broker_response = client.execute_sql::<pinot_client_rust::response::data::DataRow>(
"scoreSheet",
"SELECT * FROM scoreSheet",
true,
).unwrap();
if let Some(stats) = broker_response.stats {
log::info!(
"Query Stats: response time - {} ms, scanned docs - {}, total docs - {}",
stats.time_used_ms,
stats.num_docs_scanned,
stats.total_docs,
);
}
§Response Format
Query Response is defined as the struct pinot_client_rust::response::BrokerResponse
.
Note that pinot_client_rust::response::AggregationResults
and
pinot_client_rust::response::SelectionResults
are holders for PQL queries.
Meanwhile pinot_client_rust::response::ResultTable
is the holder for SQL queries.
Re-exports§
pub use broker_selector::BrokerSelector;
pub use client_transport::ClientTransport;
pub use connection::Connection;
pub use dynamic_broker_selector::DynamicBrokerSelector;
pub use errors::Error;
pub use errors::Result;
pub use external_view::ExternalView;
pub use json_http_client_transport::JsonHttpClientTransport;
pub use request::Request;
pub use simple_broker_selector::SimpleBrokerSelector;
pub use crate::zookeeper::ZookeeperConfig;