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.
  • Field Details

    • MATERIALIZED_TABLE_MAX_INITIAL_CAPACITY

      public static final int MATERIALIZED_TABLE_MAX_INITIAL_CAPACITY
      Maximum initial capacity of the materialized table.
      See Also:
    • MATERIALIZED_TABLE_MAX_OVERCOMMIT

      public static final int MATERIALIZED_TABLE_MAX_OVERCOMMIT
      Maximum overcommitment of the materialized table.
      See Also:
    • MATERIALIZED_TABLE_CAPACITY_FACTOR

      public static final double MATERIALIZED_TABLE_CAPACITY_FACTOR
      Factor for the initial capacity of the materialized table.
      See Also:
    • MATERIALIZED_TABLE_OVERCOMMIT_FACTOR

      public static final double MATERIALIZED_TABLE_OVERCOMMIT_FACTOR
      Factor for cleaning up deleted rows in the materialized table.
      See Also:
    • 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<org.apache.flink.table.data.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 Details

    • MaterializedCollectResultBase

      public MaterializedCollectResultBase(StatementResult tableResult, int maxRowCount, int overcommitThreshold)
  • Method Details

    • 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 interface MaterializedResult
    • retrievePage

      public List<org.apache.flink.table.data.RowData> retrievePage(int page)
      Description copied from interface: MaterializedResult
      Retrieves a page of a snapshotted result.
      Specified by:
      retrievePage in interface MaterializedResult
    • computeMaterializedTableCapacity

      protected static int computeMaterializedTableCapacity(int maxRowCount)
    • computeMaterializedTableOvercommit

      protected static int computeMaterializedTableOvercommit(int maxRowCount)
    • getMaterializedTable

      @VisibleForTesting protected List<org.apache.flink.table.data.RowData> getMaterializedTable()