diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalOlapScanToPhysicalOlapScan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalOlapScanToPhysicalOlapScan.java index 6bcf22a9ad..43436355ae 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalOlapScanToPhysicalOlapScan.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalOlapScanToPhysicalOlapScan.java @@ -94,7 +94,10 @@ public class LogicalOlapScanToPhysicalOlapScan extends OneImplementationRuleFact if (hashColumns.size() != hashDistributionInfo.getDistributionColumns().size()) { for (Slot slot : baseOutput) { for (Column column : hashDistributionInfo.getDistributionColumns()) { - if (((SlotReference) slot).getColumn().get().equals(column)) { + // If the length of the column in the bucket key changes after DDL, the length cannot be + // determined. As a result, some bucket fields are lost in the query execution plan. + // So here we use the column name to avoid this problem + if (((SlotReference) slot).getColumn().get().getName().equalsIgnoreCase(column.getName())) { hashColumns.add(slot.getExprId()); } } @@ -108,7 +111,10 @@ public class LogicalOlapScanToPhysicalOlapScan extends OneImplementationRuleFact List hashColumns = Lists.newArrayList(); for (Slot slot : output) { for (Column column : hashDistributionInfo.getDistributionColumns()) { - if (((SlotReference) slot).getColumn().get().equals(column)) { + // If the length of the column in the bucket key changes after DDL, the length cannot be + // determined. As a result, some bucket fields are lost in the query execution plan. + // So here we use the column name to avoid this problem + if (((SlotReference) slot).getColumn().get().getName().equalsIgnoreCase(column.getName())) { hashColumns.add(slot.getExprId()); } }