This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 591bf48c7 IMPALA-14013: DROP INCREMENTAL STATS throws
NullPointerException for Iceberg tables
591bf48c7 is described below
commit 591bf48c72d78b27bb2377d58a829424418e0426
Author: Mihaly Szjatinya <[email protected]>
AuthorDate: Mon Sep 15 18:24:48 2025 +0200
IMPALA-14013: DROP INCREMENTAL STATS throws NullPointerException for
Iceberg tables
Similarly to 'COMPUTE INCREMENTAL STATS', 'DROP INCREMENTAL STATS'
should prohibit the partition variant for Iceberg tables.
Testing:
- FE: fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java
- EE: tests/query_test/test_iceberg.py
Change-Id: If3d9ef45a9c9ddce9a5e43c5058ae84f919e0283
Reviewed-on: http://gerrit.cloudera.org:8080/23394
Reviewed-by: Noemi Pap-Takacs <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
.../org/apache/impala/analysis/ComputeStatsStmt.java | 8 ++++----
.../java/org/apache/impala/analysis/DropStatsStmt.java | 18 ++++++++++++++++++
.../org/apache/impala/analysis/AnalyzeDDLTest.java | 14 ++++++++++++--
.../queries/QueryTest/iceberg-compute-stats.test | 6 +++++-
4 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java
b/fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java
index 952126a07..a4e7533a9 100644
--- a/fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java
@@ -410,16 +410,16 @@ public class ComputeStatsStmt extends StatementBase
implements SingleTableStmt {
if (!(table_ instanceof FeFsTable)) {
if (partitionSet_ != null) {
- throw new AnalysisException("COMPUTE INCREMENTAL ... PARTITION not
supported " +
- "for non-HDFS table " + tableName_);
+ throw new AnalysisException("COMPUTE INCREMENTAL STATS ... PARTITION "
+
+ "not supported for non-filesystem-based table " + tableName_);
}
isIncremental_ = false;
}
if (table_ instanceof FeIcebergTable) {
if (partitionSet_ != null) {
- throw new AnalysisException("COMPUTE INCREMENTAL ... PARTITION not
supported " +
- "for Iceberg table " + tableName_);
+ throw new AnalysisException("COMPUTE INCREMENTAL STATS ... PARTITION "
+
+ "not supported for Iceberg table " + tableName_);
}
isIncremental_ = false;
}
diff --git a/fe/src/main/java/org/apache/impala/analysis/DropStatsStmt.java
b/fe/src/main/java/org/apache/impala/analysis/DropStatsStmt.java
index 5eafa631a..510293a58 100644
--- a/fe/src/main/java/org/apache/impala/analysis/DropStatsStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/DropStatsStmt.java
@@ -20,6 +20,9 @@ package org.apache.impala.analysis;
import java.util.List;
import org.apache.impala.authorization.Privilege;
+import org.apache.impala.catalog.FeFsTable;
+import org.apache.impala.catalog.FeIcebergTable;
+import org.apache.impala.catalog.FeTable;
import org.apache.impala.common.AnalysisException;
import org.apache.impala.thrift.TDropStatsParams;
import org.apache.impala.thrift.TTableName;
@@ -105,6 +108,21 @@ public class DropStatsStmt extends StatementBase
implements SingleTableStmt {
String.format("DROP STATS not allowed on a nested collection: %s",
tableName_));
}
tableRef_.analyze(analyzer);
+
+ FeTable table_ = analyzer.getTable(tableName_, Privilege.ALTER);
+ if (!(table_ instanceof FeFsTable)) {
+ if (partitionSet_ != null) {
+ throw new AnalysisException("DROP INCREMENTAL STATS ... PARTITION " +
+ "not supported for non-filesystem-based table " + tableName_);
+ }
+ }
+ if (table_ instanceof FeIcebergTable) {
+ if (partitionSet_ != null) {
+ throw new AnalysisException("DROP INCREMENTAL STATS ... PARTITION " +
+ "not supported for Iceberg table " + tableName_);
+ }
+ }
+
// There is no transactional HMS API to drop stats at the moment
(HIVE-22104).
analyzer.ensureTableNotTransactional(tableRef_.getTable(), "DROP STATS");
if (partitionSet_ != null) {
diff --git a/fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java
b/fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java
index bd4cbf314..2c013ed8b 100644
--- a/fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java
@@ -2037,8 +2037,12 @@ public class AnalyzeDDLTest extends FrontendTestBase {
"partition(year=2010, month=1, day is NULL)");
AnalysisError("compute incremental stats functional_hbase.alltypes " +
- "partition(year=2010, month=1)", "COMPUTE INCREMENTAL ... PARTITION
not " +
- "supported for non-HDFS table functional_hbase.alltypes");
+ "partition(year=2010, month=1)", "COMPUTE INCREMENTAL STATS ...
PARTITION not " +
+ "supported for non-filesystem-based table functional_hbase.alltypes");
+
+ AnalysisError("compute incremental stats
functional_parquet.iceberg_partitioned "
+ + "partition(year=2010, month=1)", "COMPUTE INCREMENTAL STATS ...
PARTITION "
+ + "not supported for Iceberg table
functional_parquet.iceberg_partitioned");
AnalysisError("compute incremental stats functional.view_view",
"COMPUTE STATS not supported for view: functional.view_view");
@@ -2097,6 +2101,12 @@ public class AnalyzeDDLTest extends FrontendTestBase {
AnalysisError(
"drop incremental stats functional.alltypes partition(year=9999,
month=10)",
"No matching partition(s) found.");
+ AnalysisError("drop incremental stats functional_hbase.alltypes "
+ + "partition(year=2010, month=1)", "DROP INCREMENTAL STATS ...
PARTITION "
+ + "not supported for non-filesystem-based table
functional_hbase.alltypes");
+ AnalysisError("drop incremental stats
functional_parquet.iceberg_partitioned "
+ + "partition(year=2010, month=1)", "DROP INCREMENTAL STATS ...
PARTITION "
+ + "not supported for Iceberg table
functional_parquet.iceberg_partitioned");
}
diff --git
a/testdata/workloads/functional-query/queries/QueryTest/iceberg-compute-stats.test
b/testdata/workloads/functional-query/queries/QueryTest/iceberg-compute-stats.test
index e03307d65..296bf683a 100644
---
a/testdata/workloads/functional-query/queries/QueryTest/iceberg-compute-stats.test
+++
b/testdata/workloads/functional-query/queries/QueryTest/iceberg-compute-stats.test
@@ -387,7 +387,11 @@ STRING, STRING, BIGINT, BIGINT, BIGINT, DOUBLE, BIGINT,
BIGINT
---- QUERY
COMPUTE INCREMENTAL STATS ice_alltypes_part PARTITION (i=1);
---- CATCH
-COMPUTE INCREMENTAL ... PARTITION not supported for Iceberg table
+COMPUTE INCREMENTAL STATS ... PARTITION not supported for Iceberg table
+---- QUERY
+DROP INCREMENTAL STATS ice_alltypes_part PARTITION (i=1);
+---- CATCH
+DROP INCREMENTAL STATS ... PARTITION not supported for Iceberg table
====
---- QUERY