Class HadoopTableOperations
- All Implemented Interfaces:
TableOperations
This maintains metadata in a "metadata" folder under the table location.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHadoopTableOperations(org.apache.hadoop.fs.Path location, FileIO fileIO, org.apache.hadoop.conf.Configuration conf, LockManager lockManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit(TableMetadata base, TableMetadata metadata) Replace the base table metadata with a new version.current()Return the currently loaded table metadata, without checking for updates.protected org.apache.hadoop.fs.FileSystemgetFileSystem(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration hadoopConf) io()Returns aFileIOto read and write table data and metadata files.Returns aLocationProviderthat supplies locations for new new data files.metadataFileLocation(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.refresh()Return the current table metadata after checking for updates.temp(TableMetadata uncommittedMetadata) Return a temporaryTableOperationsinstance that uses configuration from uncommitted metadata.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.TableOperations
encryption, newSnapshotId, requireStrictCleanup
-
Constructor Details
-
HadoopTableOperations
protected HadoopTableOperations(org.apache.hadoop.fs.Path location, FileIO fileIO, org.apache.hadoop.conf.Configuration conf, LockManager lockManager)
-
-
Method Details
-
current
Description copied from interface:TableOperationsReturn the currently loaded table metadata, without checking for updates.- Specified by:
currentin interfaceTableOperations- Returns:
- table metadata
-
refresh
Description copied from interface:TableOperationsReturn the current table metadata after checking for updates.- Specified by:
refreshin interfaceTableOperations- Returns:
- table metadata
-
commit
Description copied from interface:TableOperationsReplace 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.
Implementations must throw a
CommitStateUnknownExceptionin cases where it cannot be determined if the commit succeeded or failed. For example if a network partition causes the confirmation of the commit to be lost, the implementation should throw a CommitStateUnknownException. This is important because downstream users of this API need to know whether they can clean up the commit or not, if the state is unknown then it is not safe to remove any files. All other exceptions will be treated as if the commit has failed.- Specified by:
commitin interfaceTableOperations- Parameters:
base- table metadata on which changes were basedmetadata- new table metadata with updates
-
io
Description copied from interface:TableOperationsReturns aFileIOto read and write table data and metadata files.- Specified by:
ioin interfaceTableOperations
-
locationProvider
Description copied from interface:TableOperationsReturns aLocationProviderthat supplies locations for new new data files.- Specified by:
locationProviderin interfaceTableOperations- Returns:
- a location provider configured for the current table state
-
metadataFileLocation
Description copied from interface:TableOperationsGiven 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).- Specified by:
metadataFileLocationin interfaceTableOperations
-
temp
Description copied from interface:TableOperationsReturn 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
TableOperations.refresh()orTableOperations.commit(TableMetadata, TableMetadata).- Specified by:
tempin interfaceTableOperations- Parameters:
uncommittedMetadata- uncommitted table metadata- Returns:
- a temporary table operations that behaves like the uncommitted metadata is current
-
getFileSystem
protected org.apache.hadoop.fs.FileSystem getFileSystem(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration hadoopConf)
-