public class FastBatchingCellReader extends Object implements CellReader
FastBatchingCellReader
doesn't really Read cells: when asked
to look up the values of stored measures, it lies, and records the fact
that the value was asked for. Later, we can look over the values which
are required, fetch them in an efficient way, and re-run the evaluation
with a real evaluator.
NOTE: When it doesn't know the answer, it lies by returning an error object. The calling code must be able to deal with that.
This class tries to minimize the amount of storage needed to record the fact that a cell was requested.
Constructor and Description |
---|
FastBatchingCellReader(Execution execution,
RolapCube cube,
AggregationManager aggMgr)
Creates a FastBatchingCellReader.
|
Modifier and Type | Method and Description |
---|---|
Object |
get(RolapEvaluator evaluator)
Returns the value of the cell which has the context described by the
evaluator.
|
(package private) Dialect |
getDialect()
Returns the SQL dialect.
|
int |
getHitCount() |
int |
getMissCount()
Returns the number of times this cell reader has told a lie
(since creation), because the required cell value is not in the
cache.
|
int |
getPendingCount() |
boolean |
isDirty()
Returns whether this reader has told a lie.
|
(package private) boolean |
loadAggregations()
Resolves any pending cell reads using the cache.
|
void |
recordCellRequest(CellRequest request) |
(package private) void |
setDirty(boolean dirty)
Sets the flag indicating that the reader has told a lie.
|
public FastBatchingCellReader(Execution execution, RolapCube cube, AggregationManager aggMgr)
execution
- Execution that calling statement belongs to. Allows us
to check for cancelcube
- Cube that requests belong toaggMgr
- Aggregation managerpublic Object get(RolapEvaluator evaluator)
CellReader
If no aggregation contains the required cell, returns null.
If the value is null, returns Util.nullValue
.
get
in interface CellReader
Util.nullValue
if
the value is nullpublic int getMissCount()
CellReader
getMissCount
in interface CellReader
public int getHitCount()
public int getPendingCount()
public final void recordCellRequest(CellRequest request)
public boolean isDirty()
setDirty(boolean)
has been
called.isDirty
in interface CellReader
boolean loadAggregations()
The method is implemented by making an asynchronous call to the cache manager. The result is a list of segments that satisfies every cell request.
The client should put the resulting segments into its "query local" cache, to ensure that future cells in that segment can be answered without a call to the cache manager. (That is probably 1000x faster.)
The cache manager does not inform where client where each segment came from. There are several possibilities:
GROUP BY
statementFurthermore, segments in external cache may take some time to retrieve (a LAN round trip, say 1 millisecond, is a reasonable guess); and the request may fail. (It depends on the cache, but caches are at liberty to 'forget' segments.) So, any strategy that relies on cache segments should be able to fall back. Even if there are fall backs, only one call needs to be made to the cache manager.
Dialect getDialect()
void setDirty(boolean dirty)