|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.execute.CardinalityCounter
This is a decorator (in Design Patterns Terminology) class to enhance the functionality of a RowLocationRetRowSource. It assumes that the rows are coming in sorted order from the row source and it simply keeps track of the cardinality of all the leading columns.
Field Summary | |
private long[] |
cardinality
|
private long |
numRows
|
private DataValueDescriptor[] |
prevKey
|
private RowLocationRetRowSource |
rowSource
|
Constructor Summary | |
CardinalityCounter(RowLocationRetRowSource rowSource)
|
Method Summary | |
private DataValueDescriptor[] |
clone(DataValueDescriptor[] clonee)
|
void |
closeRowSource()
closeRowSource tells the RowSource that it will no longer need to return any rows and it can release any resource it may have. |
long[] |
getCardinality()
return the array of cardinalities that are kept internally. |
DataValueDescriptor[] |
getNextRowFromRowSource()
Gets next row from the row source and update the count of unique values that are returned. |
long |
getRowCount()
get the number of rows seen in the row source thus far. |
FormatableBitSet |
getValidColumns()
getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call. |
void |
keepCount(DataValueDescriptor[] currentKey)
|
boolean |
needsRowLocation()
needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource. |
boolean |
needsToClone()
Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. |
void |
rowLocation(RowLocation rl)
rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private RowLocationRetRowSource rowSource
private DataValueDescriptor[] prevKey
private long[] cardinality
private long numRows
Constructor Detail |
public CardinalityCounter(RowLocationRetRowSource rowSource)
Method Detail |
public boolean needsRowLocation()
RowLocationRetRowSource
needsRowLocation
in interface RowLocationRetRowSource
RowLocationRetRowSource.needsRowLocation()
public void rowLocation(RowLocation rl) throws StandardException
RowLocationRetRowSource
boolean needsRL = rowSource.needsRowLocation(); DataValueDescriptor[] row; while((row = rowSource.getNextRowFromRowSource()) != null) { RowLocation rl = heapConglomerate.insertRow(row); if (needsRL) rowSource.rowLocation(rl); }
rowLocation
in interface RowLocationRetRowSource
StandardException
- on errorRowLocationRetRowSource.rowLocation(org.apache.derby.iapi.types.RowLocation)
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
getNextRowFromRowSource
in interface RowSource
StandardException
- Cloudscape Standard Error PolicyRowSource.getNextRowFromRowSource()
public boolean needsToClone()
RowSource
needsToClone
in interface RowSource
RowSource.needsToClone()
public FormatableBitSet getValidColumns()
RowSource
getValidColumns
in interface RowSource
RowSource.getValidColumns()
public void closeRowSource()
RowSource
closeRowSource
in interface RowSource
RowSource.closeRowSource()
private DataValueDescriptor[] clone(DataValueDescriptor[] clonee)
public void keepCount(DataValueDescriptor[] currentKey) throws StandardException
StandardException
public long[] getCardinality()
public long getRowCount()
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |