You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2024/08/15 21:14:46 UTC
(impala) 02/05: IMPALA-12850: Add better error message for REFRESH iceberg_tbl PARTITION(...)
This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 135a8e76dcee4e7b6e405b879adbf1fcb9d496ad
Author: Noemi Pap-Takacs <np...@cloudera.com>
AuthorDate: Mon Jul 15 12:48:51 2024 +0200
IMPALA-12850: Add better error message for REFRESH iceberg_tbl PARTITION(...)
Iceberg table partition keys are not recorded in HMS, because
of the various partition transforms that the Iceberg spec makes
possible. Therefore Iceberg tables do not support partition-grained
refresh.
The previous error message was not descriptive; it originated from
the different partition handling logic that Impala has for Iceberg
tables compared to HDFS tables.
Added a more user-friendly, Iceberg-specific error message.
Testing:
- AnalyzerTest
Change-Id: Id4bccf3eac533a00c156d2a5631523684b5e5b9c
Reviewed-on: http://gerrit.cloudera.org:8080/21594
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java | 6 ++++++
fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java | 4 ++--
fe/src/test/java/org/apache/impala/analysis/AnalyzerTest.java | 3 +++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java b/fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java
index 2ce541c3a..156e67ba9 100644
--- a/fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java
+++ b/fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.impala.catalog.Column;
+import org.apache.impala.catalog.FeIcebergTable;
import org.apache.impala.catalog.HdfsTable;
import org.apache.impala.catalog.Type;
import org.apache.impala.common.AnalysisException;
@@ -61,6 +62,11 @@ public class PartitionSpec extends PartitionSpecBase {
@Override
public void analyze(Analyzer analyzer) throws AnalysisException {
super.analyze(analyzer);
+ // Iceberg partition keys are not stored in HMS.
+ if (table_ instanceof FeIcebergTable) {
+ throw new AnalysisException(String.format("Partition clause in this statement is " +
+ "not supported for Iceberg tables."));
+ }
// Make sure static partition key values only contain constant exprs.
for (PartitionKeyValue kv: partitionSpec_) {
diff --git a/fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java b/fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java
index 723b90db8..aca9a47b4 100644
--- a/fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java
+++ b/fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java
@@ -83,12 +83,12 @@ public abstract class PartitionSpecBase extends StmtNode {
throw new AnalysisException(e.getMessage(), e);
}
- // Make sure the target table is partitioned.
+ // Make sure the target table is partitioned. The table format can be either HDFS or
+ // Iceberg, but only HDFS table partition keys are stored in HMS.
if (!isPartitioned(table)) {
throw new AnalysisException("Table is not partitioned: " + tableName_);
}
- // Only HDFS tables are partitioned.
Preconditions.checkState(table instanceof FeFsTable);
table_ = (FeFsTable) table;
nullPartitionKeyValue_ = table_.getNullPartitionKeyValue();
diff --git a/fe/src/test/java/org/apache/impala/analysis/AnalyzerTest.java b/fe/src/test/java/org/apache/impala/analysis/AnalyzerTest.java
index aa761a239..397885a12 100644
--- a/fe/src/test/java/org/apache/impala/analysis/AnalyzerTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/AnalyzerTest.java
@@ -458,6 +458,9 @@ public class AnalyzerTest extends FrontendTestBase {
+ "Expected type: 'INT'");
AnalysisError("refresh functional.zipcode_incomes partition (year=2009, month=1)",
"Table is not partitioned: functional.zipcode_incomes");
+ AnalysisError(
+ "refresh functional_parquet.iceberg_partitioned partition(action='view')",
+ "Partition clause in this statement is not supported for Iceberg tables.");
}
@Test