From 46a2158ce9160e93f54f461c0b562c55a6899784 Mon Sep 17 00:00:00 2001 From: morningman Date: Thu, 4 Dec 2025 14:59:49 +0800 Subject: [PATCH] [fix](hive) fix potential inconsistent hive partition info cache --- .../org/apache/doris/datasource/hive/HMSExternalTable.java | 5 ++++- .../apache/doris/datasource/iceberg/IcebergMetadataOps.java | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java index 13979124244cb6..2b64a7cd6e2eae 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java @@ -743,7 +743,10 @@ public long fetchRowCount() { } private List initPartitionColumns(List schema) { - List partitionKeys = remoteTable.getPartitionKeys().stream().map(FieldSchema::getName) + // get table from remote, do not use `remoteTable` directly, + // because here we need to get schema from latest table info. + Table newTable = ((HMSExternalCatalog) catalog).getClient().getTable(dbName, name); + List partitionKeys = newTable.getPartitionKeys().stream().map(FieldSchema::getName) .collect(Collectors.toList()); List partitionColumns = Lists.newArrayListWithCapacity(partitionKeys.size()); for (String partitionKey : partitionKeys) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java index a5f6a70b977b56..55378d41589088 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java @@ -145,6 +145,8 @@ public List listDatabaseNames() { try { return executionAuthenticator.execute(() -> listNestedNamespaces(getNamespace())); } catch (Exception e) { + LOG.warn("failed to list database names in catalog {}, root cause: {}", + dorisCatalog.getName(), Util.getRootCauseMessage(e), e); throw new RuntimeException("Failed to list database names, error message is:" + e.getMessage(), e); } }