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 @@ -165,6 +165,9 @@ public HiveIcebergMetaHook(Configuration conf) {

@Override
public void preCreateTable(org.apache.hadoop.hive.metastore.api.Table hmsTable) {
if (hmsTable.isTemporary()) {
throw new UnsupportedOperationException("Creation of temporary iceberg tables is not supported.");
}
this.catalogProperties = getCatalogProperties(hmsTable);

// Set the table type even for non HiveCatalog based tables
Expand All @@ -173,7 +176,7 @@ public void preCreateTable(org.apache.hadoop.hive.metastore.api.Table hmsTable)

if (!Catalogs.hiveCatalog(conf, catalogProperties)) {
if (Boolean.parseBoolean(this.catalogProperties.getProperty(hive_metastoreConstants.TABLE_IS_CTLT))) {
throw new RuntimeException("CTLT target table must be a HiveCatalog table.");
throw new UnsupportedOperationException("CTLT target table must be a HiveCatalog table.");
}
// For non-HiveCatalog tables too, we should set the input and output format
// so that the table can be read by other engines like Impala
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,22 @@ public void testCTLTHiveCatalogValidation() throws TException, InterruptedExcept
testTables.propertiesForCreateTableSQL(ImmutableMap.of())));
})
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining(" CTLT target table must be a HiveCatalog table");
.hasMessageContaining("CTLT target table must be a HiveCatalog table");
}

@Test
public void testCreateTemporaryTable() {
TableIdentifier identifier = TableIdentifier.of("default", "customers");
String query = String.format("CREATE temporary TABLE customers (customer_id BIGINT, first_name STRING, last_name " +
"STRING) STORED BY iceberg %s %s",
testTables.locationForCreateTableSQL(identifier),
testTables.propertiesForCreateTableSQL(ImmutableMap.of()));

Assertions.assertThatThrownBy(() -> {
shell.executeStatement(query);
})
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Creation of temporary iceberg tables is not supported");
}

@Test
Expand Down