public class HadoopTableOperations extends java.lang.Object implements TableOperations
This maintains metadata in a "metadata" folder under the table location.
| Modifier | Constructor and Description |
|---|---|
protected |
HadoopTableOperations(org.apache.hadoop.fs.Path location,
org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
void |
commit(TableMetadata base,
TableMetadata metadata)
Replace the base table metadata with a new version.
|
TableMetadata |
current()
Return the currently loaded table metadata, without checking for updates.
|
protected org.apache.hadoop.fs.FileSystem |
getFileSystem(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration hadoopConf) |
FileIO |
io() |
LocationProvider |
locationProvider()
Returns a
LocationProvider that supplies locations for new new data files. |
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.
|
TableMetadata |
refresh()
Return the current table metadata after checking for updates.
|
TableOperations |
temp(TableMetadata uncommittedMetadata)
Return a temporary
TableOperations instance that uses configuration from uncommitted metadata. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitencryption, newSnapshotIdprotected HadoopTableOperations(org.apache.hadoop.fs.Path location,
org.apache.hadoop.conf.Configuration conf)
public TableMetadata current()
TableOperationscurrent in interface TableOperationspublic TableMetadata refresh()
TableOperationsrefresh in interface TableOperationspublic void commit(TableMetadata base, TableMetadata metadata)
TableOperationsThis 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.
commit in interface TableOperationsbase - table metadata on which changes were basedmetadata - new table metadata with updatespublic FileIO io()
io in interface TableOperationsFileIO to read and write table data and metadata filespublic LocationProvider locationProvider()
TableOperationsLocationProvider that supplies locations for new new data files.locationProvider in interface TableOperationspublic java.lang.String metadataFileLocation(java.lang.String fileName)
TableOperations
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).
metadataFileLocation in interface TableOperationspublic TableOperations temp(TableMetadata uncommittedMetadata)
TableOperationsTableOperations instance 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 TableOperations.refresh() or TableOperations.commit(TableMetadata, TableMetadata).
temp in interface TableOperationsuncommittedMetadata - uncommitted table metadataprotected org.apache.hadoop.fs.FileSystem getFileSystem(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration hadoopConf)