Class GenericAggregateResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.GenericAggregateResultSet
- All Implemented Interfaces:
NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
- Direct Known Subclasses:
GroupedAggregateResultSet, ScalarAggregateResultSet
Generic aggregation utilities.
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AggregatorInfoListprotected GenericAggregator[]protected NoPutResultSetprivate final ExecIndexRowFields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSetFields inherited from class BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArrayFields inherited from interface NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBERFields inherited from interface ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST -
Constructor Summary
ConstructorsConstructorDescriptionGenericAggregateResultSet(NoPutResultSet s, int aggregateItem, Activation a, int ra, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()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 final ExecIndexRowFinish the aggregation for the current row.(package private) ExecIndexRowGet a template row of the right shape for sorting or returning results.protected final 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.Produce an xml image of this ResultSet and its descendant ResultSets.Methods inherited from class NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, close, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRowMethods inherited from class BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, 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, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXMLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NoPutResultSet
openCoreMethods inherited from interface ResultSet
getTimeSpent
-
Field Details
-
aggregates
-
aggInfoList
-
source
-
originalSource
-
rowTemplate
-
-
Constructor Details
-
GenericAggregateResultSet
GenericAggregateResultSet(NoPutResultSet s, int aggregateItem, Activation a, int ra, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException Constructor- Parameters:
a- activationra- reference to a saved row allocator instanceresultSetNumber- result set numberoptimizerEstimatedRowCount- optimizer estimated row countoptimizerEstimatedCost- optimizer estimated cost- Throws:
StandardException- Thrown on error
-
-
Method Details
-
getRowTemplate
ExecIndexRow getRowTemplate()Get a template row of the right shape for sorting or returning results. The template is cached, so it may need to be cloned if callers use it for multiple purposes at the same time.- Returns:
- a row template of the right shape for this result set
-
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 upeliminateDistincts- should distincts be ignored. Used to toss out distinct aggregates for a prelim sort.lcc- the lccinputResultSet- the incoming result set- Returns:
- the array of GenericAggregators
- Throws:
StandardException- on error
-
finishAggregation
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
Description copied from interface:ResultSetTells 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:
finishin interfaceResultSet- Overrides:
finishin classBasicNoPutResultSetImpl- Throws:
StandardException- on error
-
toXML
Description copied from interface:ResultSetProduce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.
- Specified by:
toXMLin interfaceResultSet- Overrides:
toXMLin classBasicNoPutResultSetImpl- Parameters:
parentNode- Node to put content into.tag- Element tag for content- Returns:
- the content as an element with the given tag name
- Throws:
Exception
-