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 <npaptakacs@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Mihaly Szjatinya
2025-09-15 18:24:48 +02:00
committed by Noemi Pap-Takacs
parent 0513c071b4
commit 591bf48c72
4 changed files with 39 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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");
}

View File

@@ -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