Package org.pipecraft.infra.bq
Interface BQQuery<R,F>
-
- Type Parameters:
R- The type a row is transformed toF- The final result type (Optional, useVoidif not relevant)
- All Known Subinterfaces:
BQDMLQuery,BQResultlessQuery
- All Known Implementing Classes:
CreateTableDMLQuery
public interface BQQuery<R,F>An BQ query to be executed usingBigQueryConnector- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Faggregate(Iterator<R> it)default Map<String,com.google.cloud.bigquery.QueryParameterValue>getQueryParameters()Used for supporting named parameters.StringgetSQL()default booleanisLegacySQL()default FmapAndAggregate(Iterator<com.google.cloud.bigquery.FieldValueList> it)RmapRow(com.google.cloud.bigquery.FieldValueList row)
-
-
-
Method Detail
-
getSQL
String getSQL()
- Returns:
- The BigQuery SQL to execute
-
mapRow
R mapRow(com.google.cloud.bigquery.FieldValueList row)
- Parameters:
row- A result set row- Returns:
- The object the row is converted to
-
aggregate
F aggregate(Iterator<R> it) throws BQException
- Parameters:
it- An iterator over transformed rows (i.e. rows processed with transformRow(..)). Memory efficient - results are streamed during the iteration.- Returns:
- The final result object, obtained by aggregating all result rows
- Throws:
BQException- In case that the results can't be aggregated
-
mapAndAggregate
default F mapAndAggregate(Iterator<com.google.cloud.bigquery.FieldValueList> it) throws BQException
- Parameters:
it- An iterator on raw results- Returns:
- The final result, obtained by mapping individual rows and then aggregating all
- Throws:
BQException
-
isLegacySQL
default boolean isLegacySQL()
- Returns:
- true if this is a legacy sql query (default=false)
-
getQueryParameters
default Map<String,com.google.cloud.bigquery.QueryParameterValue> getQueryParameters()
Used for supporting named parameters. The default implementation disables named parameters. Override this method to support it. For every parameter used in the query (e.g. `@param`), there must be one entry with key `param`.- Returns:
- the parameter names mapped to their values. Null means that the query doesn't contain any named parameters (default).
-
-