[fix](Nereids) Fixed a bug where the execution plan was incorrect after ddl (#30107)

should only compare column name when generate data dist info of PhysicalOlapScan

Co-authored-by: xingying01 <xingying01@corp.netease.com>
This commit is contained in:
xy
2024-01-22 15:10:46 +08:00
committed by yiguolei
parent 9b100207d2
commit 45f6cba837

View File

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