Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv abstract Class GenericAggregateResultSet

extends NoPutResultSetImpl
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet, org.apache.derby.impl.sql.execute.ScalarAggregateResultSet
Imports
java.util.Vector, org.w3c.dom.Element, .Node, .NodeList, org.apache.derby.shared.common.error.SQLWarningFactory, .StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.loader.ClassFactory, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.sql.execute.ExecIndexRow, .ExecPreparedStatement, .ExecRowBuilder, .ExecutionFactory, .NoPutResultSet

Generic aggregation utilities.

Field Summary

Modifier and TypeField and Description
protected AggregatorInfoList
protected GenericAggregator[]
protected NoPutResultSet
private final ExecIndexRow
public NoPutResultSet
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
pack-priv
GenericAggregateResultSet(NoPutResultSet s, int aggregateItem, Activation
activation
a
,
int
reference to a saved row allocator instance
ra
,
int
result set number
resultSetNumber
,
double
optimizer estimated row count
optimizerEstimatedRowCount
,
double
optimizer estimated cost
optimizerEstimatedCost
)

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
finish()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finish.

Implements org.apache.derby.iapi.sql.ResultSet.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 final ExecIndexRow

Returns:

the result row. If the input row != null, then the result row == input row
finishAggregation
(ExecIndexRow
the row to finish aggregation
row
)

Finish the aggregation for the current row.

pack-priv ExecIndexRow

Returns:

a row template of the right shape for this result set
getRowTemplate
()

Get a template row of the right shape for sorting or returning results.

protected final GenericAggregator[]

Returns:

the array of GenericAggregators
getSortAggregators
(AggregatorInfoList
the list of aggregators to set up
list
,
boolean
should distincts be ignored. Used to toss out distinct aggregates for a prelim sort.
eliminateDistincts
,
LanguageConnectionContext
the lcc
lcc
,
NoPutResultSet
the incoming result set
inputResultSet
)

For each AggregatorInfo in the list, generate a GenericAggregator and stick it in an array of GenericAggregators.

public Element
toXML(Element
Node to put content into.
parentNode
,
String
Element tag for content
tag
)

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.toXML.

Implements org.apache.derby.iapi.sql.ResultSet.toXML.

Produce an xml image of this ResultSet and its descendant ResultSets.

Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
clearCurrentRowclearOrderableCacheclosecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsisForUpdatemarkRowAsDeletedneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValueupdateRow

Field Detail

aggInfoListback to summary
protected AggregatorInfoList aggInfoList
aggregatesback to summary
protected GenericAggregator[] aggregates
originalSourceback to summary
protected NoPutResultSet originalSource
rowTemplateback to summary
private final ExecIndexRow rowTemplate
sourceback to summary
public NoPutResultSet source

Constructor Detail

GenericAggregateResultSetback to summary
pack-priv GenericAggregateResultSet(NoPutResultSet s, int aggregateItem, Activation a, int ra, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException

Constructor

Parameters
a:Activation

activation

ra:int

reference to a saved row allocator instance

resultSetNumber:int

result set number

optimizerEstimatedRowCount:double

optimizer estimated row count

optimizerEstimatedCost:double

optimizer estimated cost

Exceptions
StandardException:
Thrown on error

Method Detail

finishback to summary
public void finish() throws StandardException

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finish.

Implements org.apache.derby.iapi.sql.ResultSet.finish.

Doc from org.apache.derby.iapi.sql.ResultSet.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(). Will close the result set if it is not already closed.

Annotations
@Override
Exceptions
StandardException:
on error
finishAggregationback to summary
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:ExecIndexRow

the row to finish aggregation

Returns:ExecIndexRow

the result row. If the input row != null, then the result row == input row

Exceptions
StandardException:
Thrown on error
getRowTemplateback to summary
pack-priv 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:ExecIndexRow

a row template of the right shape for this result set

getSortAggregatorsback to summary
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:AggregatorInfoList

the list of aggregators to set up

eliminateDistincts:boolean

should distincts be ignored. Used to toss out distinct aggregates for a prelim sort.

lcc:LanguageConnectionContext

the lcc

inputResultSet:NoPutResultSet

the incoming result set

Returns:GenericAggregator[]

the array of GenericAggregators

Annotations
@SuppressWarnings:UseOfObsoleteCollectionType
Exceptions
StandardException:
on error
toXMLback to summary
public Element toXML(Element parentNode, String tag) throws Exception

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.toXML.

Implements org.apache.derby.iapi.sql.ResultSet.toXML.

Doc from org.apache.derby.iapi.sql.ResultSet.toXML.

Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.

Parameters
parentNode:Element

Node to put content into.

tag:String

Element tag for content

Returns:Element

the content as an element with the given tag name

Exceptions
Exception:
on error