org.apache.derby.impl.sql.execute
Class GenericAggregateResultSet

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
      extended by org.apache.derby.impl.sql.execute.NoPutResultSetImpl
          extended by org.apache.derby.impl.sql.execute.GenericAggregateResultSet
All Implemented Interfaces:
NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
Direct Known Subclasses:
GroupedAggregateResultSet, ScalarAggregateResultSet

abstract class GenericAggregateResultSet
extends NoPutResultSetImpl

Generic aggregation utilities.


Field Summary
protected  AggregatorInfoList aggInfoList
           
protected  GenericAggregator[] aggregates
           
protected  NoPutResultSet originalSource
           
protected  GeneratedMethod rowAllocator
           
 NoPutResultSet source
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSet
 
Fields inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE
 
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
 
Constructor Summary
GenericAggregateResultSet(NoPutResultSet s, int aggregateItem, Activation a, GeneratedMethod ra, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
          Constructor
 
Method Summary
 void finish()
          Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open().
protected  ExecIndexRow finishAggregation(ExecIndexRow row)
          Finish the aggregation for the current row.
protected  GenericAggregator[] getSortAggregators(AggregatorInfoList list, boolean eliminateDistincts, LanguageConnectionContext lcc, NoPutResultSet inputResultSet)
          For each AggregatorInfo in the list, generate a GenericAggregator and stick it in an array of GenericAggregators.
 
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, close, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsToClone, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, updateRow
 
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getNextRowCore, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
openCore
 
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
getTimeSpent
 

Field Detail

aggregates

protected GenericAggregator[] aggregates

rowAllocator

protected GeneratedMethod rowAllocator

aggInfoList

protected AggregatorInfoList aggInfoList

source

public NoPutResultSet source

originalSource

protected NoPutResultSet originalSource
Constructor Detail

GenericAggregateResultSet

GenericAggregateResultSet(NoPutResultSet s,
                          int aggregateItem,
                          Activation a,
                          GeneratedMethod ra,
                          int resultSetNumber,
                          double optimizerEstimatedRowCount,
                          double optimizerEstimatedCost)
                    throws StandardException
Constructor

Parameters:
a - activation
ra - row allocator generated method
resultSetNumber - result set number
optimizerEstimatedRowCount - optimizer estimated row count
optimizerEstimatedCost - optimizer estimated cost
Throws:
StandardException - Thrown on error
Method Detail

getSortAggregators

protected final GenericAggregator[] getSortAggregators(AggregatorInfoList list,
                                                       boolean eliminateDistincts,
                                                       LanguageConnectionContext lcc,
                                                       NoPutResultSet inputResultSet)
                                                throws StandardException
For each AggregatorInfo in the list, generate a GenericAggregator and stick it in an array of GenericAggregators.

Parameters:
list - the list of aggregators to set up
eliminateDistincts - should distincts be ignored. Used to toss out distinct aggregates for a prelim sort.
lcc - the lcc
inputResultSet - the incoming result set
Returns:
the array of GenericAggregators
Throws:
StandardException - on error

finishAggregation

protected final ExecIndexRow finishAggregation(ExecIndexRow row)
                                        throws StandardException
Finish the aggregation for the current row. Basically call finish() on each aggregator on this row. Called once per grouping on a vector aggregate or once per table on a scalar aggregate. If the input row is null, then rowAllocator is invoked to create a new row. That row is then initialized and used for the output of the aggregation.

Parameters:
row - the row to finish aggregation
Returns:
the result row. If the input row != null, then the result row == input row
Throws:
StandardException - Thrown on error

finish

public void finish()
            throws StandardException
Description copied from interface: ResultSet
Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open(). Will close the result set if it is not already closed.

Specified by:
finish in interface ResultSet
Overrides:
finish in class BasicNoPutResultSetImpl
Throws:
StandardException - on error

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.