public class SerializableTable extends java.lang.Object implements Table, java.io.Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
SerializableTable.SerializableMetadataTable |
Modifier | Constructor and Description |
---|---|
protected |
SerializableTable(Table table) |
Modifier and Type | Method and Description |
---|---|
static Table |
copyOf(Table table)
Creates a read-only serializable table that can be sent to other nodes in a cluster.
|
Snapshot |
currentSnapshot()
Get the current
snapshot for this table, or null if there are no snapshots. |
EncryptionManager |
encryption()
Returns an
EncryptionManager to encrypt and decrypt data
files. |
ExpireSnapshots |
expireSnapshots()
Create a new
expire API to manage snapshots in this table and commit. |
java.util.List<HistoryEntry> |
history()
Get the snapshot history of this table.
|
FileIO |
io()
Returns a
FileIO to read and write table data and metadata files. |
java.lang.String |
location()
Return the table's base location.
|
LocationProvider |
locationProvider()
Returns a
LocationProvider to provide locations for new data files. |
ManageSnapshots |
manageSnapshots()
Create a new
manage snapshots API to manage snapshots in this table and
commit. |
java.lang.String |
name()
Return the full name for this table.
|
AppendFiles |
newAppend()
Create a new
append API to add files to this table and commit. |
BatchScan |
newBatchScan()
Create a new
batch scan for this table. |
DeleteFiles |
newDelete()
Create a new
delete API to replace files in this table and commit. |
OverwriteFiles |
newOverwrite()
Create a new
overwrite API to overwrite files by a filter expression. |
ReplacePartitions |
newReplacePartitions()
Not recommended: Create a new
replace partitions API to dynamically
overwrite partitions in the table with new data. |
RewriteFiles |
newRewrite()
Create a new
rewrite API to replace files in this table and commit. |
RowDelta |
newRowDelta()
Create a new
row-level delta API to remove or replace rows in existing data
files. |
TableScan |
newScan()
Create a new
scan for this table. |
protected Table |
newTable(TableOperations ops,
java.lang.String tableName) |
Transaction |
newTransaction()
Create a new
transaction API to commit multiple table operations at once. |
java.util.Map<java.lang.String,java.lang.String> |
properties()
Return a map of string properties for this table.
|
void |
refresh()
Refresh the current table metadata.
|
java.util.Map<java.lang.String,SnapshotRef> |
refs()
Returns the current refs for the table
|
ReplaceSortOrder |
replaceSortOrder()
Create a new
ReplaceSortOrder to set the table sort order and commit the change. |
RewriteManifests |
rewriteManifests()
Create a new
rewrite manifests API to replace manifests for this table
and commit. |
Schema |
schema()
Return the
schema for this table. |
java.util.Map<java.lang.Integer,Schema> |
schemas()
Return a map of
schema for this table. |
Snapshot |
snapshot(long snapshotId)
Get the
snapshot of this table with the given id, or null if there is no
matching snapshot. |
java.lang.Iterable<Snapshot> |
snapshots()
Get the
snapshots of this table. |
SortOrder |
sortOrder()
Return the
sort order for this table. |
java.util.Map<java.lang.Integer,SortOrder> |
sortOrders()
Return a map of sort order IDs to
sort orders for this table. |
PartitionSpec |
spec()
Return the
partition spec for this table. |
java.util.Map<java.lang.Integer,PartitionSpec> |
specs()
Return a map of
partition specs for this table. |
java.util.List<StatisticsFile> |
statisticsFiles()
Returns the current statistics files for the table
|
UpdateLocation |
updateLocation()
Create a new
UpdateLocation to update table location and commit the changes. |
UpdateProperties |
updateProperties()
Create a new
UpdateProperties to update table properties and commit the changes. |
UpdateSchema |
updateSchema()
Create a new
UpdateSchema to alter the columns of this table and commit the change. |
UpdatePartitionSpec |
updateSpec()
Create a new
UpdatePartitionSpec to alter the partition spec of this table and commit
the change. |
UpdateStatistics |
updateStatistics()
Create a new
update table statistics API to add or remove statistics
files in this table. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newFastAppend, newIncrementalAppendScan, newIncrementalChangelogScan, snapshot
protected SerializableTable(Table table)
public static Table copyOf(Table table)
table
- the original table to copy the state fromprotected Table newTable(TableOperations ops, java.lang.String tableName)
public java.lang.String name()
Table
public java.lang.String location()
Table
public java.util.Map<java.lang.String,java.lang.String> properties()
Table
properties
in interface Table
public Schema schema()
Table
schema
for this table.public java.util.Map<java.lang.Integer,Schema> schemas()
Table
schema
for this table.public PartitionSpec spec()
Table
partition spec
for this table.public java.util.Map<java.lang.Integer,PartitionSpec> specs()
Table
partition specs
for this table.public SortOrder sortOrder()
Table
sort order
for this table.public java.util.Map<java.lang.Integer,SortOrder> sortOrders()
Table
sort orders
for this table.sortOrders
in interface Table
public FileIO io()
Table
FileIO
to read and write table data and metadata files.public EncryptionManager encryption()
Table
EncryptionManager
to encrypt and decrypt data
files.encryption
in interface Table
public LocationProvider locationProvider()
Table
LocationProvider
to provide locations for new data files.locationProvider
in interface Table
public java.util.List<StatisticsFile> statisticsFiles()
Table
statisticsFiles
in interface Table
public java.util.Map<java.lang.String,SnapshotRef> refs()
Table
public void refresh()
Table
public TableScan newScan()
Table
scan
for this table.
Once a table scan is created, it can be refined to project columns and filter data.
public BatchScan newBatchScan()
Table
batch scan
for this table.
Once a batch scan is created, it can be refined to project columns and filter data.
newBatchScan
in interface Table
public Snapshot currentSnapshot()
Table
snapshot
for this table, or null if there are no snapshots.currentSnapshot
in interface Table
public Snapshot snapshot(long snapshotId)
Table
snapshot
of this table with the given id, or null if there is no
matching snapshot.public java.lang.Iterable<Snapshot> snapshots()
Table
snapshots
of this table.public java.util.List<HistoryEntry> history()
Table
history
in interface Table
history entries
public UpdateSchema updateSchema()
Table
UpdateSchema
to alter the columns of this table and commit the change.updateSchema
in interface Table
UpdateSchema
public UpdatePartitionSpec updateSpec()
Table
UpdatePartitionSpec
to alter the partition spec of this table and commit
the change.updateSpec
in interface Table
UpdatePartitionSpec
public UpdateProperties updateProperties()
Table
UpdateProperties
to update table properties and commit the changes.updateProperties
in interface Table
UpdateProperties
public ReplaceSortOrder replaceSortOrder()
Table
ReplaceSortOrder
to set the table sort order and commit the change.replaceSortOrder
in interface Table
ReplaceSortOrder
public UpdateLocation updateLocation()
Table
UpdateLocation
to update table location and commit the changes.updateLocation
in interface Table
UpdateLocation
public AppendFiles newAppend()
Table
append API
to add files to this table and commit.newAppend
in interface Table
AppendFiles
public RewriteFiles newRewrite()
Table
rewrite API
to replace files in this table and commit.newRewrite
in interface Table
RewriteFiles
public RewriteManifests rewriteManifests()
Table
rewrite manifests API
to replace manifests for this table
and commit.rewriteManifests
in interface Table
RewriteManifests
public OverwriteFiles newOverwrite()
Table
overwrite API
to overwrite files by a filter expression.newOverwrite
in interface Table
OverwriteFiles
public RowDelta newRowDelta()
Table
row-level delta API
to remove or replace rows in existing data
files.newRowDelta
in interface Table
RowDelta
public ReplacePartitions newReplacePartitions()
Table
replace partitions API
to dynamically
overwrite partitions in the table with new data.
This is provided to implement SQL compatible with Hive table operations but is not
recommended. Instead, use the overwrite API
to explicitly overwrite
data.
newReplacePartitions
in interface Table
ReplacePartitions
public DeleteFiles newDelete()
Table
delete API
to replace files in this table and commit.newDelete
in interface Table
DeleteFiles
public UpdateStatistics updateStatistics()
Table
update table statistics API
to add or remove statistics
files in this table.updateStatistics
in interface Table
UpdateStatistics
public ExpireSnapshots expireSnapshots()
Table
expire API
to manage snapshots in this table and commit.expireSnapshots
in interface Table
ExpireSnapshots
public ManageSnapshots manageSnapshots()
Table
manage snapshots API
to manage snapshots in this table and
commit.manageSnapshots
in interface Table
ManageSnapshots
public Transaction newTransaction()
Table
transaction API
to commit multiple table operations at once.newTransaction
in interface Table
Transaction