Class MaterializedCollectResultBase
- java.lang.Object
-
- org.apache.flink.table.client.gateway.result.CollectResultBase
-
- org.apache.flink.table.client.gateway.result.MaterializedCollectResultBase
-
- All Implemented Interfaces:
DynamicResult
,MaterializedResult
- Direct Known Subclasses:
MaterializedCollectBatchResult
,MaterializedCollectStreamResult
public abstract class MaterializedCollectResultBase extends CollectResultBase implements MaterializedResult
Base class to collect results and returns them as table snapshots.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.table.client.gateway.result.CollectResultBase
CollectResultBase.ResultRetrievalThread
-
-
Field Summary
Fields Modifier and Type Field Description static double
MATERIALIZED_TABLE_CAPACITY_FACTOR
Factor for the initial capacity of the materialized table.static int
MATERIALIZED_TABLE_MAX_INITIAL_CAPACITY
Maximum initial capacity of the materialized table.static int
MATERIALIZED_TABLE_MAX_OVERCOMMIT
Maximum overcommitment of the materialized table.static double
MATERIALIZED_TABLE_OVERCOMMIT_FACTOR
Factor for cleaning up deleted rows in the materialized table.protected List<RowData>
materializedTable
Materialized table that is continuously updated by inserts and deletes.protected int
maxRowCount
Maximum number of materialized rows to be stored.protected int
overcommitThreshold
Threshold for cleaning up deleted rows in the materialized table.protected int
validRowPosition
Counter for deleted rows to be deleted at the beginning of the materialized table.-
Fields inherited from class org.apache.flink.table.client.gateway.result.CollectResultBase
executionException, resultLock, retrievalThread
-
-
Constructor Summary
Constructors Constructor Description MaterializedCollectResultBase(StatementResult tableResult, int maxRowCount, int overcommitThreshold)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
computeMaterializedTableCapacity(int maxRowCount)
protected static int
computeMaterializedTableOvercommit(int maxRowCount)
protected List<RowData>
getMaterializedTable()
List<RowData>
retrievePage(int page)
Retrieves a page of a snapshotted result.TypedResult<Integer>
snapshot(int pageSize)
Takes a snapshot of the current table and returns the number of pages for navigating through the snapshot.-
Methods inherited from class org.apache.flink.table.client.gateway.result.CollectResultBase
close, handleMissingResult, isRetrieving, processRecord
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.client.gateway.result.DynamicResult
close
-
-
-
-
Field Detail
-
MATERIALIZED_TABLE_MAX_INITIAL_CAPACITY
public static final int MATERIALIZED_TABLE_MAX_INITIAL_CAPACITY
Maximum initial capacity of the materialized table.- See Also:
- Constant Field Values
-
MATERIALIZED_TABLE_MAX_OVERCOMMIT
public static final int MATERIALIZED_TABLE_MAX_OVERCOMMIT
Maximum overcommitment of the materialized table.- See Also:
- Constant Field Values
-
MATERIALIZED_TABLE_CAPACITY_FACTOR
public static final double MATERIALIZED_TABLE_CAPACITY_FACTOR
Factor for the initial capacity of the materialized table.- See Also:
- Constant Field Values
-
MATERIALIZED_TABLE_OVERCOMMIT_FACTOR
public static final double MATERIALIZED_TABLE_OVERCOMMIT_FACTOR
Factor for cleaning up deleted rows in the materialized table.- See Also:
- Constant Field Values
-
maxRowCount
protected final int maxRowCount
Maximum number of materialized rows to be stored. After the count is reached, oldest rows are dropped.
-
overcommitThreshold
protected final int overcommitThreshold
Threshold for cleaning up deleted rows in the materialized table.
-
materializedTable
protected final List<RowData> materializedTable
Materialized table that is continuously updated by inserts and deletes. Deletes at the beginning are lazily cleaned up when the threshold is reached.
-
validRowPosition
protected int validRowPosition
Counter for deleted rows to be deleted at the beginning of the materialized table.
-
-
Constructor Detail
-
MaterializedCollectResultBase
public MaterializedCollectResultBase(StatementResult tableResult, int maxRowCount, int overcommitThreshold)
-
-
Method Detail
-
snapshot
public TypedResult<Integer> snapshot(int pageSize)
Description copied from interface:MaterializedResult
Takes a snapshot of the current table and returns the number of pages for navigating through the snapshot.- Specified by:
snapshot
in interfaceMaterializedResult
-
retrievePage
public List<RowData> retrievePage(int page)
Description copied from interface:MaterializedResult
Retrieves a page of a snapshotted result.- Specified by:
retrievePage
in interfaceMaterializedResult
-
computeMaterializedTableCapacity
protected static int computeMaterializedTableCapacity(int maxRowCount)
-
computeMaterializedTableOvercommit
protected static int computeMaterializedTableOvercommit(int maxRowCount)
-
getMaterializedTable
@VisibleForTesting protected List<RowData> getMaterializedTable()
-
-