Package org.apache.iceberg.hadoop
Class HadoopTables
- java.lang.Object
-
- org.apache.iceberg.hadoop.HadoopTables
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOCK_PROPERTY_PREFIX
-
Constructor Summary
Constructors Constructor Description HadoopTables()HadoopTables(org.apache.hadoop.conf.Configuration conf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Catalog.TableBuilderbuildTable(java.lang.String location, Schema schema)Tablecreate(Schema schema, PartitionSpec spec, SortOrder order, java.util.Map<java.lang.String,java.lang.String> properties, java.lang.String location)Create a table using the FileSystem implementation resolve from location.booleandropTable(java.lang.String location)Drop a table and delete all data and metadata files.booleandropTable(java.lang.String location, boolean purge)Drop a table; optionally delete data and metadata files.booleanexists(java.lang.String location)org.apache.hadoop.conf.ConfigurationgetConf()Tableload(java.lang.String location)Loads the table location from a FileSystem path location.TransactionnewCreateTableTransaction(java.lang.String location, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties)Start a transaction to create a table.TransactionnewReplaceTableTransaction(java.lang.String location, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate)Start a transaction to replace a table.voidsetConf(org.apache.hadoop.conf.Configuration conf)
-
-
-
Field Detail
-
LOCK_PROPERTY_PREFIX
public static final java.lang.String LOCK_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
load
public Table load(java.lang.String location)
Loads the table location from a FileSystem path location.
-
create
public Table create(Schema schema, PartitionSpec spec, SortOrder order, java.util.Map<java.lang.String,java.lang.String> properties, java.lang.String location)
Create a table using the FileSystem implementation resolve from location.- Specified by:
createin interfaceTables- Parameters:
schema- iceberg schema used to create the tablespec- partitioning spec, if null the table will be unpartitionedproperties- a string map of table properties, initialized to empty if nulllocation- a path URI (e.g. hdfs:///warehouse/my_table)- Returns:
- newly created table implementation
-
dropTable
public boolean dropTable(java.lang.String location)
Drop a table and delete all data and metadata files.- Parameters:
location- a path URI (e.g. hdfs:///warehouse/my_table)- Returns:
- true if the table was dropped, false if it did not exist
-
dropTable
public boolean dropTable(java.lang.String location, boolean purge)Drop a table; optionally delete data and metadata files.If purge is set to true the implementation should delete all data and metadata files.
- Parameters:
location- a path URI (e.g. hdfs:///warehouse/my_table)purge- if true, delete all data and metadata files in the table- Returns:
- true if the table was dropped, false if it did not exist
-
newCreateTableTransaction
public Transaction newCreateTableTransaction(java.lang.String location, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties)
Start a transaction to create a table.- Parameters:
location- a location for the tableschema- a schemaspec- a partition specproperties- a string map of table properties- Returns:
- a
Transactionto create the table - Throws:
AlreadyExistsException- if the table already exists
-
newReplaceTableTransaction
public Transaction newReplaceTableTransaction(java.lang.String location, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate)
Start a transaction to replace a table.- Parameters:
location- a location for the tableschema- a schemaspec- a partition specproperties- a string map of table propertiesorCreate- whether to create the table if not exists- Returns:
- a
Transactionto replace the table - Throws:
NoSuchTableException- if the table doesn't exist and orCreate is false
-
buildTable
public Catalog.TableBuilder buildTable(java.lang.String location, Schema schema)
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf)
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
public org.apache.hadoop.conf.Configuration getConf()
- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
-