Interface TableOperations
-
- All Known Implementing Classes:
BaseMetastoreTableOperations,HadoopTableOperations,HiveTableOperations
public interface TableOperationsSPI interface to abstract table metadata access and updates.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcommit(TableMetadata base, TableMetadata metadata)Replace the base table metadata with a new version.TableMetadatacurrent()Return the currently loaded table metadata, without checking for updates.default EncryptionManagerencryption()FileIOio()LocationProviderlocationProvider()Returns aLocationProviderthat supplies locations for new new data files.java.lang.StringmetadataFileLocation(java.lang.String fileName)Given the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.default longnewSnapshotId()Create a new ID for a SnapshotTableMetadatarefresh()Return the current table metadata after checking for updates.default TableOperationstemp(TableMetadata uncommittedMetadata)Return a temporaryTableOperationsinstance that uses configuration from uncommitted metadata.
-
-
-
Method Detail
-
current
TableMetadata current()
Return the currently loaded table metadata, without checking for updates.- Returns:
- table metadata
-
refresh
TableMetadata refresh()
Return the current table metadata after checking for updates.- Returns:
- table metadata
-
commit
void commit(TableMetadata base, TableMetadata metadata)
Replace the base table metadata with a new version.This method should implement and document atomicity guarantees.
Implementations must check that the base metadata is current to avoid overwriting updates. Once the atomic commit operation succeeds, implementations must not perform any operations that may fail because failure in this method cannot be distinguished from commit failure.
- Parameters:
base- table metadata on which changes were basedmetadata- new table metadata with updates
-
encryption
default EncryptionManager encryption()
- Returns:
- a
EncryptionManagerto encrypt and decrypt data files.
-
metadataFileLocation
java.lang.String metadataFileLocation(java.lang.String fileName)
Given the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.The file may not exist yet, in which case the path should be returned as if it were to be created by e.g.
FileIO.newOutputFile(String).
-
locationProvider
LocationProvider locationProvider()
Returns aLocationProviderthat supplies locations for new new data files.- Returns:
- a location provider configured for the current table state
-
temp
default TableOperations temp(TableMetadata uncommittedMetadata)
Return a temporaryTableOperationsinstance that uses configuration from uncommitted metadata.This is called by transactions when uncommitted table metadata should be used; for example, to create a metadata file location based on metadata in the transaction that has not been committed.
Transactions will not call
refresh()orcommit(TableMetadata, TableMetadata).- Parameters:
uncommittedMetadata- uncommitted table metadata- Returns:
- a temporary table operations that behaves like the uncommitted metadata is current
-
newSnapshotId
default long newSnapshotId()
Create a new ID for a Snapshot- Returns:
- a long snapshot ID
-
-