public class CardinalityCounter extends java.lang.Object implements RowLocationRetRowSource
| Modifier and Type | Field and Description |
|---|---|
private long[] |
cardinality |
private long |
numRows |
private DataValueDescriptor[] |
prevKey |
private RowLocationRetRowSource |
rowSource |
| Constructor and Description |
|---|
CardinalityCounter(RowLocationRetRowSource rowSource) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
private RowLocationRetRowSource rowSource
private DataValueDescriptor[] prevKey
private long[] cardinality
private long numRows
public CardinalityCounter(RowLocationRetRowSource rowSource)
public boolean needsRowLocation()
RowLocationRetRowSourceneedsRowLocation in interface RowLocationRetRowSourceRowLocationRetRowSource.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 RowLocationRetRowSourceStandardException - on errorRowLocationRetRowSource.rowLocation(org.apache.derby.iapi.types.RowLocation)public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
getNextRowFromRowSource in interface RowSourceStandardException - Standard Derby Error PolicyRowSource.getNextRowFromRowSource()public boolean needsToClone()
RowSourceneedsToClone in interface RowSourceRowSource.needsToClone()public FormatableBitSet getValidColumns()
RowSourcegetValidColumns in interface RowSourceRowSource.getValidColumns()public void closeRowSource()
RowSourcecloseRowSource in interface RowSourceRowSource.closeRowSource()private DataValueDescriptor[] clone(DataValueDescriptor[] clonee)
public void keepCount(DataValueDescriptor[] currentKey) throws StandardException
StandardExceptionpublic long[] getCardinality()
public long getRowCount()
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.