Class SerializableTable

  • All Implemented Interfaces:
    java.io.Serializable, Table
    Direct Known Subclasses:
    SerializableTable.SerializableMetadataTable, SerializableTableWithSize

    public class SerializableTable
    extends java.lang.Object
    implements Table, java.io.Serializable
    A read-only serializable table that can be sent to other nodes in a cluster.

    An instance of this class represents an immutable serializable copy of a table state and will not reflect any subsequent changed made to the original table.

    While this class captures the metadata file location that can be used to load the complete table metadata, it directly persists the current schema, spec, sort order, table properties to avoid reading the metadata file from other nodes for frequently needed metadata.

    The implementation assumes the passed instances of FileIO, EncryptionManager, LocationProvider are serializable. If you are serializing the table using a custom serialization framework like Kryo, those instances of FileIO, EncryptionManager, LocationProvider must be supported by that particular serialization framework.

    Note: loading the complete metadata from a large number of nodes can overwhelm the storage.

    See Also:
    Serialized Form
    • Constructor Detail

      • SerializableTable

        protected SerializableTable​(Table table)
    • Method Detail

      • copyOf

        public static Table copyOf​(Table table)
        Creates a read-only serializable table that can be sent to other nodes in a cluster.
        Parameters:
        table - the original table to copy the state from
        Returns:
        a read-only serializable table reflecting the current state of the original table
      • name

        public java.lang.String name()
        Description copied from interface: Table
        Return the full name for this table.
        Specified by:
        name in interface Table
        Returns:
        this table's name
      • location

        public java.lang.String location()
        Description copied from interface: Table
        Return the table's base location.
        Specified by:
        location in interface Table
        Returns:
        this table's location
      • properties

        public java.util.Map<java.lang.String,​java.lang.String> properties()
        Description copied from interface: Table
        Return a map of string properties for this table.
        Specified by:
        properties in interface Table
        Returns:
        this table's properties map
      • schema

        public Schema schema()
        Description copied from interface: Table
        Return the schema for this table.
        Specified by:
        schema in interface Table
        Returns:
        this table's schema
      • schemas

        public java.util.Map<java.lang.Integer,​Schema> schemas()
        Description copied from interface: Table
        Return a map of schema for this table.
        Specified by:
        schemas in interface Table
        Returns:
        this table's schema map
      • specs

        public java.util.Map<java.lang.Integer,​PartitionSpec> specs()
        Description copied from interface: Table
        Return a map of partition specs for this table.
        Specified by:
        specs in interface Table
        Returns:
        this table's partition specs map
      • sortOrder

        public SortOrder sortOrder()
        Description copied from interface: Table
        Return the sort order for this table.
        Specified by:
        sortOrder in interface Table
        Returns:
        this table's sort order
      • sortOrders

        public java.util.Map<java.lang.Integer,​SortOrder> sortOrders()
        Description copied from interface: Table
        Return a map of sort order IDs to sort orders for this table.
        Specified by:
        sortOrders in interface Table
        Returns:
        this table's sort orders map
      • io

        public FileIO io()
        Description copied from interface: Table
        Returns a FileIO to read and write table data and metadata files.
        Specified by:
        io in interface Table
      • statisticsFiles

        public java.util.List<StatisticsFile> statisticsFiles()
        Description copied from interface: Table
        Returns the current statistics files for the table
        Specified by:
        statisticsFiles in interface Table
        Returns:
        the current statistics files for the table
      • refs

        public java.util.Map<java.lang.String,​SnapshotRef> refs()
        Description copied from interface: Table
        Returns the current refs for the table
        Specified by:
        refs in interface Table
        Returns:
        the current refs for the table
      • refresh

        public void refresh()
        Description copied from interface: Table
        Refresh the current table metadata.
        Specified by:
        refresh in interface Table
      • newScan

        public TableScan newScan()
        Description copied from interface: Table
        Create a new scan for this table.

        Once a table scan is created, it can be refined to project columns and filter data.

        Specified by:
        newScan in interface Table
        Returns:
        a table scan for this table
      • newBatchScan

        public BatchScan newBatchScan()
        Description copied from interface: Table
        Create a new batch scan for this table.

        Once a batch scan is created, it can be refined to project columns and filter data.

        Specified by:
        newBatchScan in interface Table
        Returns:
        a batch scan for this table
      • currentSnapshot

        public Snapshot currentSnapshot()
        Description copied from interface: Table
        Get the current snapshot for this table, or null if there are no snapshots.
        Specified by:
        currentSnapshot in interface Table
        Returns:
        the current table Snapshot.
      • snapshot

        public Snapshot snapshot​(long snapshotId)
        Description copied from interface: Table
        Get the snapshot of this table with the given id, or null if there is no matching snapshot.
        Specified by:
        snapshot in interface Table
        Returns:
        the Snapshot with the given id.
      • snapshots

        public java.lang.Iterable<Snapshot> snapshots()
        Description copied from interface: Table
        Get the snapshots of this table.
        Specified by:
        snapshots in interface Table
        Returns:
        an Iterable of snapshots of this table.