Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hive.iceberg.org.apache.avro.generic.GenericData;
import org.apache.hive.iceberg.org.apache.avro.generic.GenericRecordBuilder;
import org.apache.iceberg.BaseTable;
import org.apache.iceberg.DataFile;
import org.apache.iceberg.DataFiles;
import org.apache.iceberg.FileScanTask;
import org.apache.iceberg.Files;
import org.apache.iceberg.HasTableOperations;
import org.apache.iceberg.ManifestFile;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableMetadataParser;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.TableUtil;
import org.apache.iceberg.avro.Avro;
import org.apache.iceberg.avro.AvroSchemaUtil;
import org.apache.iceberg.catalog.Namespace;
Expand Down Expand Up @@ -259,7 +258,7 @@ public void testDropTable() throws IOException {
.as("Table manifest files should not exist")
.doesNotExist();
}
assertThat(new File(((HasTableOperations) table).operations().current().metadataFileLocation()
assertThat(new File(TableUtil.metadataFileLocation(table)
.replace("file:", "")))
.as("Table metadata file should not exist")
.doesNotExist();
Expand Down Expand Up @@ -552,7 +551,7 @@ public void testRegisterHadoopTableToHiveCatalog() throws IOException, TExceptio
.hasMessage("Table does not exist: hivedb.table1");

// register the table to hive catalog using the latest metadata file
String latestMetadataFile = ((BaseTable) table).operations().current().metadataFileLocation();
String latestMetadataFile = TableUtil.metadataFileLocation(table);
catalog.registerTable(identifier, "file:" + latestMetadataFile);
assertThat(HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME, "table1")).isNotNull();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.hadoop.hive.ql.ddl.misc.sortoder.ZOrderFields;
import org.apache.hadoop.hive.ql.util.NullOrdering;
import org.apache.iceberg.BaseMetastoreTableOperations;
import org.apache.iceberg.BaseTable;
import org.apache.iceberg.NullOrder;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.PartitionSpecParser;
Expand All @@ -57,6 +56,7 @@
import org.apache.iceberg.SortOrderParser;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.TableUtil;
import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.exceptions.NoSuchTableException;
import org.apache.iceberg.exceptions.NotFoundException;
Expand Down Expand Up @@ -440,7 +440,7 @@ static boolean isOrcFileFormat(org.apache.hadoop.hive.metastore.api.Table hmsTab
}

protected void setWriteModeDefaults(Table icebergTbl, Map<String, String> newProps, EnvironmentContext context) {
if ((icebergTbl == null || ((BaseTable) icebergTbl).operations().current().formatVersion() == 1) &&
if ((icebergTbl == null || TableUtil.formatVersion(icebergTbl) == 1) &&
IcebergTableUtil.isV2TableOrAbove(newProps)) {
List<String> writeModeList = ImmutableList.of(
TableProperties.DELETE_MODE, TableProperties.UPDATE_MODE, TableProperties.MERGE_MODE);
Expand Down Expand Up @@ -472,7 +472,7 @@ public void postGetTable(org.apache.hadoop.hive.metastore.api.Table hmsTable) {
if (hmsTable != null) {
try {
Table tbl = IcebergTableUtil.getTable(conf, hmsTable);
String formatVersion = String.valueOf(((BaseTable) tbl).operations().current().formatVersion());
String formatVersion = String.valueOf(TableUtil.formatVersion(tbl));
hmsTable.getParameters().put(TableProperties.FORMAT_VERSION, formatVersion);
// Set the serde info
hmsTable.getSd().setInputFormat(HiveIcebergInputFormat.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import org.apache.iceberg.TableMetadata;
import org.apache.iceberg.TableMetadataParser;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.TableUtil;
import org.apache.iceberg.Transaction;
import org.apache.iceberg.UpdatePartitionSpec;
import org.apache.iceberg.UpdateProperties;
Expand Down Expand Up @@ -552,7 +553,7 @@ public void rollbackAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTab
}

// we want to keep the data files but get rid of the metadata directory
String metadataLocation = ((BaseTable) this.icebergTable).operations().current().metadataFileLocation();
String metadataLocation = TableUtil.metadataFileLocation(this.icebergTable);
try {
Path path = new Path(metadataLocation).getParent();
FileSystem.get(path.toUri(), conf).delete(path, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static HiveIcebergWriter writer(JobConf jc) {
}

private static void setWriterLevelConfiguration(JobConf jc, Table table) {
final String writeFormat = table.properties().get("write.format.default");
final String writeFormat = table.properties().get(TableProperties.DEFAULT_FILE_FORMAT);
if (writeFormat == null || "PARQUET".equalsIgnoreCase(writeFormat)) {
if (table.properties().get(TableProperties.PARQUET_ROW_GROUP_SIZE_BYTES) == null &&
jc.get(ParquetOutputFormat.BLOCK_SIZE) != null) {
Expand Down
Loading