Package org.pipecraft.infra.bq
Class BQResultsIterator<R,F>
- java.lang.Object
-
- org.pipecraft.infra.bq.BQResultsIterator<R,F>
-
- Type Parameters:
R- The row object data typeF- The aggregated result data type
- All Implemented Interfaces:
Iterator<R>
public class BQResultsIterator<R,F> extends Object implements Iterator<R>
A decorator on BQ result set iterator. Provides: 1) Total row count 2) A method for aggregating all rows using the originating query's aggregation logic. 3) Conversion of runtime errors during iteration to the standard QueryResultBrokenException.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Faggregate()Call this method only if the originating query supports aggregation.voidforEachRemaining(Consumer<? super R> action)booleanhasNext()Rnext()voidremove()longtotalRecordCount()
-
-
-
Method Detail
-
forEachRemaining
public void forEachRemaining(Consumer<? super R> action)
- Specified by:
forEachRemainingin interfaceIterator<R>
-
totalRecordCount
public long totalRecordCount()
- Returns:
- The total number of records in the result set
-
aggregate
public F aggregate() throws BQException
Call this method only if the originating query supports aggregation.- Returns:
- The final result object, obtained by aggregating all iterator's rows
- Throws:
BQException- In case of a BigQuery error during iteration, or if in case of a logical error during aggregation.
-
-