Package com.influxdb.client.internal
Class InfluxQLQueryApiImpl
java.lang.Object
com.influxdb.internal.AbstractRestClient
com.influxdb.internal.AbstractQueryApi
com.influxdb.client.internal.InfluxQLQueryApiImpl
- All Implemented Interfaces:
InfluxQLQueryApi
-
Nested Class Summary
Nested classes/interfaces inherited from class com.influxdb.internal.AbstractQueryApi
AbstractQueryApi.FluxRecordIterator, AbstractQueryApi.RawIterator
-
Field Summary
Fields inherited from class com.influxdb.internal.AbstractQueryApi
DEFAULT_DIALECT, EMPTY_ACTION, ERROR_CONSUMER, fluxCsvParser, LOG, resultMapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionquery
(InfluxQLQuery influxQlQuery) Executes an InfluxQL query against the legacy endpoint.query
(InfluxQLQuery influxQlQuery, InfluxQLQueryResult.Series.ValueExtractor valueExtractor) Executes an InfluxQL query against the legacy endpoint.Methods inherited from class com.influxdb.internal.AbstractQueryApi
createBody, query, query, queryIterator, queryRaw, queryRawIterator
Methods inherited from class com.influxdb.internal.AbstractRestClient
execute, getLogLevel, ping, responseToError, setLogLevel, toInfluxException, version
-
Constructor Details
-
InfluxQLQueryApiImpl
-
-
Method Details
-
query
Description copied from interface:InfluxQLQueryApi
Executes an InfluxQL query against the legacy endpoint.- Specified by:
query
in interfaceInfluxQLQueryApi
- Parameters:
influxQlQuery
- the query- Returns:
- the result
-
query
@Nonnull public InfluxQLQueryResult query(@Nonnull InfluxQLQuery influxQlQuery, @Nullable InfluxQLQueryResult.Series.ValueExtractor valueExtractor) Description copied from interface:InfluxQLQueryApi
Executes an InfluxQL query against the legacy endpoint. The value extractor is called for each resulting column to convert the string value returned by query into a custom type.Example:
InfluxQLQueryResult result = influxQLQueryApi.query( new InfluxQLQuery("SELECT FIRST(\"free\") FROM \"influxql\"", DATABASE_NAME) .setPrecision(InfluxQLQuery.InfluxQLPrecision.SECONDS), (columnName, rawValue, resultIndex, seriesName) -> { switch (columnName) { case "time": return Instant.ofEpochSecond(Long.parseLong(rawValue)); case "first": return new BigDecimal(rawValue); default: throw new IllegalArgumentException("unexpected column " + columnName); } } );
- Specified by:
query
in interfaceInfluxQLQueryApi
- Parameters:
influxQlQuery
- the queryvalueExtractor
- a callback, to convert column values- Returns:
- the result
-