From 120c66f202726f25478b09f25b2eff4dd2f182a6 Mon Sep 17 00:00:00 2001 From: seawinde Date: Mon, 23 Sep 2024 20:36:37 +0800 Subject: [PATCH] fix regression test --- .../trees/plans/logical/LogicalOlapScan.java | 21 ++++++++++++++++--- .../doris/regression/suite/Suite.groovy | 6 +++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java index 15e06816c1a95b..6149e939ae4063 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java @@ -48,6 +48,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.json.JSONObject; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -566,9 +567,23 @@ public void computeFd(DataTrait.Builder builder) { Map constructReplaceMap(MTMV mtmv) { Map replaceMap = new HashMap<>(); - List originOutputs = mtmv.getCache().getOriginalPlan().getOutput(); - for (int i = 0; i < getOutput().size(); i++) { - replaceMap.put(originOutputs.get(i), getOutput().get(i)); + // Need remove invisible column, and then mapping them + List originOutputs = new ArrayList<>(); + for (Slot originSlot : mtmv.getCache().getOriginalPlan().getOutput()) { + if (!(originSlot instanceof SlotReference) || (((SlotReference) originSlot).isVisible())) { + originOutputs.add(originSlot); + } + } + List targetOutputs = new ArrayList<>(); + for (Slot targeSlot : getOutput()) { + if (!(targeSlot instanceof SlotReference) || (((SlotReference) targeSlot).isVisible())) { + targetOutputs.add(targeSlot); + } + } + Preconditions.checkArgument(originOutputs.size() == targetOutputs.size(), + "constructReplaceMap, the size of originOutputs and targetOutputs should be same"); + for (int i = 0; i < targetOutputs.size(); i++) { + replaceMap.put(originOutputs.get(i), targetOutputs.get(i)); } return replaceMap; } diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy index 56e026df8512f8..7c556409dfcca6 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy @@ -1305,7 +1305,7 @@ class Suite implements GroovyInterceptable { } Assert.assertEquals("SUCCESS", status) logger.info("waitingMTMVTaskFinished analyze mv name is " + result.last().get(5)) - sql "analyze table ${mvName} with sync;" + sql "analyze table ${result.last().get(6)}.${mvName} with sync;" } void waitingMTMVTaskFinishedByMvNameAllowCancel(String mvName) { @@ -1330,7 +1330,7 @@ class Suite implements GroovyInterceptable { Assert.assertEquals("SUCCESS", status) // Need to analyze materialized view for cbo to choose the materialized view accurately logger.info("waitingMTMVTaskFinished analyze mv name is " + result.last().get(5)) - sql "analyze table ${mvName} with sync;" + sql "analyze table ${result.last().get(6)}.${mvName} with sync;" } void waitingPartitionIsExpected(String tableName, String partitionName, boolean expectedStatus) { @@ -1381,7 +1381,7 @@ class Suite implements GroovyInterceptable { Assert.assertEquals("SUCCESS", status) // Need to analyze materialized view for cbo to choose the materialized view accurately logger.info("waitingMTMVTaskFinished analyze mv name is " + result.last().get(5)) - sql "analyze table ${result.last().get(5)} with sync;" + sql "analyze table ${result.last().get(6)}.${result.last().get(5)} with sync;" } void waitingMTMVTaskFinishedNotNeedSuccess(String jobName) {