public class MetricsSqlQueryService extends Object implements MetricsQueryService
| Modifier and Type | Class and Description |
|---|---|
private class |
MetricsSqlQueryService.PreparedStatementException |
| Modifier and Type | Field and Description |
|---|---|
private int |
defaultPrecision |
private int |
defaultScale |
private ComponentLog |
logger |
private com.github.benmanes.caffeine.cache.Cache<String,BlockingQueue<CachedStatement>> |
statementQueues |
| Constructor and Description |
|---|
MetricsSqlQueryService(ComponentLog logger,
int defaultPrecision,
int defaultScale) |
| Modifier and Type | Method and Description |
|---|---|
private CachedStatement |
buildCachedStatement(String sql,
ReportingContext context) |
private void |
clearQueue(BlockingQueue<CachedStatement> statementQueue) |
void |
closeQuietly(AutoCloseable... closeables) |
private org.apache.calcite.jdbc.CalciteConnection |
createConnection() |
private org.apache.calcite.schema.SchemaPlus |
createRootSchema(org.apache.calcite.jdbc.CalciteConnection calciteConnection) |
ComponentLog |
getLogger() |
ResultSetRecordSet |
getResultSetRecordSet(QueryResult queryResult) |
private CachedStatement |
getStatement(String sql,
Supplier<CachedStatement> statementBuilder,
com.github.benmanes.caffeine.cache.Cache<String,BlockingQueue<CachedStatement>> statementQueues) |
private void |
onCacheEviction(String key,
BlockingQueue<CachedStatement> queue,
com.github.benmanes.caffeine.cache.RemovalCause cause) |
QueryResult |
query(ReportingContext context,
String sql) |
private final ComponentLog logger
private final int defaultPrecision
private final int defaultScale
private final com.github.benmanes.caffeine.cache.Cache<String,BlockingQueue<CachedStatement>> statementQueues
public MetricsSqlQueryService(ComponentLog logger, int defaultPrecision, int defaultScale)
public ComponentLog getLogger()
public QueryResult query(ReportingContext context, String sql) throws Exception
query in interface MetricsQueryServiceExceptionpublic ResultSetRecordSet getResultSetRecordSet(QueryResult queryResult) throws Exception
getResultSetRecordSet in interface MetricsQueryServiceExceptionprivate CachedStatement getStatement(String sql, Supplier<CachedStatement> statementBuilder, com.github.benmanes.caffeine.cache.Cache<String,BlockingQueue<CachedStatement>> statementQueues)
private CachedStatement buildCachedStatement(String sql, ReportingContext context) throws Exception
Exceptionprivate org.apache.calcite.schema.SchemaPlus createRootSchema(org.apache.calcite.jdbc.CalciteConnection calciteConnection)
private org.apache.calcite.jdbc.CalciteConnection createConnection()
private void clearQueue(BlockingQueue<CachedStatement> statementQueue)
public void closeQuietly(AutoCloseable... closeables)
closeQuietly in interface MetricsQueryServiceprivate void onCacheEviction(String key, BlockingQueue<CachedStatement> queue, com.github.benmanes.caffeine.cache.RemovalCause cause)
Copyright © 2022 Apache NiFi Project. All rights reserved.