Skip to content

Commit

Permalink
Document why Iceberg table needs to be external in metastore
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi authored and losipiuk committed Feb 24, 2022
1 parent c5f5a1f commit 4d2dc44
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ protected void commitNewTable(TableMetadata metadata)
.setDatabaseName(database)
.setTableName(tableName)
.setOwner(owner)
// Table needs to be EXTERNAL, otherwise table rename in HMS would rename table directory and break table contents.
.setTableType(TableType.EXTERNAL_TABLE.name())
.setDataColumns(toHiveColumns(metadata.schema().columns()))
.withStorage(storage -> storage.setLocation(metadata.location()))
.withStorage(storage -> storage.setStorageFormat(STORAGE_FORMAT))
// This is a must-have property for the EXTERNAL_TABLE table type
.setParameter("EXTERNAL", "TRUE")
.setParameter(TABLE_TYPE_PROP, ICEBERG_TABLE_TYPE_VALUE)
.setParameter(METADATA_LOCATION_PROP, newMetadataLocation);
Expand Down

0 comments on commit 4d2dc44

Please sign in to comment.