Record Class ReadCommand

java.lang.Object
java.lang.Record
org.apache.iceberg.flink.maintenance.operator.ReadCommand
All Implemented Interfaces:
Serializable

@Internal public record ReadCommand(ContentScanTask<?> task, Long mainSnapshotId, Long indexGeneration, long dataSequenceNumber, boolean staging) extends Record implements Serializable
Envelope from the EqualityConvertPlanner to the EqualityConvertReader, wrapping an Iceberg ContentScanTask plus the metadata the reader needs to process it.

The wrapped task is either:

  • A FileScanTask for data files: native tasks from table.newScan() for main reindex, or a FlinkAddedRowsScanTask wrapper for bare DataFiles from SnapshotChanges#addedDataFiles.
  • An EqualityDeleteFileScanTask for equality delete files.

The equality field IDs are static for the lifetime of the job and carried on the reader itself, not per-record.

mainSnapshotId is sent for diagnostic output.

indexGeneration is used by the index to order eager evictions by.

dataSequenceNumber is the wrapped file's sequence number (data file or equality delete), propagated to the worker so a delete only deletes rows older than itself.

staging is true for a staging snapshot's new data rows, which the index defers until after this cycle's delete resolves; false for main reindex data and equality deletes.

See Also:
  • Constructor Details

    • ReadCommand

      public ReadCommand(ContentScanTask<?> task, Long mainSnapshotId, Long indexGeneration, long dataSequenceNumber, boolean staging)
      Creates an instance of a ReadCommand record class.
      Parameters:
      task - the value for the task record component
      mainSnapshotId - the value for the mainSnapshotId record component
      indexGeneration - the value for the indexGeneration record component
      dataSequenceNumber - the value for the dataSequenceNumber record component
      staging - the value for the staging record component
  • Method Details

    • dataFile

      public static ReadCommand dataFile(FileScanTask task, Long mainSnapshotId, Long indexGeneration, long dataSequenceNumber)
    • stagingDataFile

      public static ReadCommand stagingDataFile(FileScanTask task, Long mainSnapshotId, Long indexGeneration, long dataSequenceNumber)
    • eqDeleteFile

      public static ReadCommand eqDeleteFile(DeleteFile file, PartitionSpec spec, Long mainSnapshotId, Long indexGeneration, long dataSequenceNumber)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • task

      public ContentScanTask<?> task()
      Returns the value of the task record component.
      Returns:
      the value of the task record component
    • mainSnapshotId

      public Long mainSnapshotId()
      Returns the value of the mainSnapshotId record component.
      Returns:
      the value of the mainSnapshotId record component
    • indexGeneration

      public Long indexGeneration()
      Returns the value of the indexGeneration record component.
      Returns:
      the value of the indexGeneration record component
    • dataSequenceNumber

      public long dataSequenceNumber()
      Returns the value of the dataSequenceNumber record component.
      Returns:
      the value of the dataSequenceNumber record component
    • staging

      public boolean staging()
      Returns the value of the staging record component.
      Returns:
      the value of the staging record component