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

pack-priv Class DistinctScalarAggregateResultSet

extends ScalarAggregateResultSet
Class Inheritance
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.execute.ExecRow, .ExecIndexRow, .NoPutResultSet, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.store.access.ColumnOrdering, .SortObserver, .TransactionController, .SortController, .ScanController, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.io.FormatableArrayHolder, java.util.Properties

This ResultSet evaluates scalar aggregates where 1 (or more, in the future) of the aggregates are distinct. It will scan the entire source result set and calculate the scalar aggregates when scanning the source during the first call to next().

Field Summary

Modifier and TypeField and Description
private boolean
private int
private ColumnOrdering[]
private ScanController
private boolean
private long
private ExecIndexRow
Inherited from org.apache.derby.impl.sql.execute.ScalarAggregateResultSet:
countOfRowsisInSortedOrderrowsInputsingleInputRowsourceExecIndexRow

Constructor Summary

AccessConstructor and Description
pack-priv
DistinctScalarAggregateResultSet(NoPutResultSet
input result set
s
,
boolean
true if the source results are in sorted order
isInSortedOrder
,
int
indicates the number of the SavedObject off of the PreparedStatement that holds the AggregatorInfoList used by this routine.
aggregateItem
,
int orderingItem, Activation
activation
a
,
int
saved object that builds an empty output row
ra
,
int maxRowSize, int
The resultSetNumber for this result set
resultSetNumber
,
boolean singleInputRow, double optimizerEstimatedRowCount, double optimizerEstimatedCost)

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.close.

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

If the result set has been opened, close the open scan.

protected void
closeSource()

Close the source of whatever we have been scanning.

public ExecRow
public ExecIndexRow
getRowFromResultSet(boolean
- true of the row should be cloned
doClone
)

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.getRowFromResultSet.

Get a row from the sorter.

private ScanController

Returns:

the sort controller
loadSorter
()

Load up the sorter.

public void
public void
Inherited from org.apache.derby.impl.sql.execute.ScalarAggregateResultSet:
accumulateScalarAggregationgetCurrentRowgetRowLocationgetTimeSpent

Field Detail

dropDistinctAggSortback to summary
private boolean dropDistinctAggSort
maxRowSizeback to summary
private int maxRowSize
orderback to summary
private ColumnOrdering[] order
scanControllerback to summary
private ScanController scanController
sortedback to summary
private boolean sorted
sortIdback to summary
private long sortId
sortResultRowback to summary
private ExecIndexRow sortResultRow

Constructor Detail

DistinctScalarAggregateResultSetback to summary
pack-priv DistinctScalarAggregateResultSet(NoPutResultSet s, boolean isInSortedOrder, int aggregateItem, int orderingItem, Activation a, int ra, int maxRowSize, int resultSetNumber, boolean singleInputRow, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException

Constructor

Parameters
s:NoPutResultSet

input result set

isInSortedOrder:boolean

true if the source results are in sorted order

aggregateItem:int

indicates the number of the SavedObject off of the PreparedStatement that holds the AggregatorInfoList used by this routine.

a:Activation

activation

ra:int

saved object that builds an empty output row

resultSetNumber:int

The resultSetNumber for this result set

Exceptions
StandardException:
Thrown on error

Method Detail

closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.close.

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

If the result set has been opened, close the open scan.

Exceptions
StandardException:

Doc from org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.close.

thrown on error

closeSourceback to summary
protected void closeSource() throws StandardException

Close the source of whatever we have been scanning.

Exceptions
StandardException:
thrown on error
getNextRowCoreback to summary
public ExecRow getNextRowCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.getNextRowCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

Return the next row. If it is a scalar aggregate scan

Returns:ExecRow

the next row in the result

Exceptions
StandardException:
  • thrown on failure.
  • ResultSetNotOpen thrown if not yet open.
getRowFromResultSetback to summary
public ExecIndexRow getRowFromResultSet(boolean doClone) throws StandardException

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.getRowFromResultSet.

Get a row from the sorter. Side effects: sets currentRow.

Parameters
doClone:boolean

Doc from org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.getRowFromResultSet.

- true of the row should be cloned

Exceptions
StandardException:
Thrown on error
loadSorterback to summary
private ScanController loadSorter() throws StandardException

Load up the sorter. Feed it every row from the source scan. If we have a vector aggregate, initialize the aggregator for each source row. When done, close the source scan and open the sort. Return the sort scan controller.

Returns:ScanController

the sort controller

Exceptions
StandardException:
thrown on failure.
openCoreback to summary
public void openCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.openCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.openCore.

Open the scan. Load the sorter and prepare to get rows from it.

Exceptions
StandardException:
thrown if cursor finished.
reopenCoreback to summary
public void reopenCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.ScalarAggregateResultSet.reopenCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.reopenCore.

reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Exceptions
StandardException:
thrown if cursor finished.