This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 2dbfbeefc1a HIVE-27729: Iceberg: Check Iceberg type in
AlterTableExecuteAnalyzer (#4747). (zhangbutao, reviewed by Ayush Saxena)
2dbfbeefc1a is described below
commit 2dbfbeefc1a73d6a50f1c829658846fc827fc780
Author: Butao Zhang <[email protected]>
AuthorDate: Thu Sep 28 13:44:43 2023 +0800
HIVE-27729: Iceberg: Check Iceberg type in AlterTableExecuteAnalyzer
(#4747). (zhangbutao, reviewed by Ayush Saxena)
---
.../org/apache/iceberg/mr/hive/TestHiveIcebergRollback.java | 10 ++++++++++
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java | 3 ++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergRollback.java
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergRollback.java
index 45141ca96c0..2bf7d11a680 100644
---
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergRollback.java
+++
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergRollback.java
@@ -134,4 +134,14 @@ public class TestHiveIcebergRollback extends
HiveIcebergStorageHandlerWithEngine
table.history().get(1).snapshotId() + ")");
});
}
+
+ @Test
+ public void testNonIcebergRollback() {
+ shell.executeStatement("CREATE TABLE non_ice (id int)");
+
+ AssertHelpers.assertThrows("should throw exception",
IllegalArgumentException.class,
+ "ALTER EXECUTE is not supported for table", () -> {
+ shell.executeStatement("ALTER TABLE non_ice EXECUTE
ROLLBACK('2022-09-26 00:00:00')");
+ });
+ }
}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 7632ffd9141..d6189b1fa65 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -6771,7 +6771,8 @@ private void constructOneLBLocationMap(FileStatus fSta,
public void alterTableExecuteOperation(Table table, AlterTableExecuteSpec
executeSpec) throws HiveException {
try {
- HiveStorageHandler storageHandler =
createStorageHandler(table.getTTable());
+ HiveStorageHandler storageHandler =
Optional.ofNullable(createStorageHandler(table.getTTable())).orElseThrow(() ->
+ new UnsupportedOperationException(String.format("ALTER EXECUTE is
not supported for table %s", table.getTableName())));
storageHandler.executeOperation(table, executeSpec);
} catch (MetaException e) {
throw new HiveException(e);