Class BQResultsIterator<R,​F>

  • Type Parameters:
    R - The row object data type
    F - 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 Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<R>
      • next

        public R next()
        Specified by:
        next in interface Iterator<R>
      • remove

        public void remove()
        Specified by:
        remove in interface Iterator<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.