From bd23f2cda2e2dc73a633c3242423b4d287e0bc04 Mon Sep 17 00:00:00 2001 From: EmmyMiao87 <522274284@qq.com> Date: Thu, 27 Feb 2020 18:19:34 +0800 Subject: [PATCH] [MaterializedView] Fix bug that result is double when new mv selector is enable (#3012) The issue is #3011. Reset the tablet and scan range info before compute it. The old rollup selector has computed tablet and scan range info. Then the new mv selector maybe compute tablet and scan range info again sometimes. So, we need to reset those info in here. Before this commit, the result is double when query is "select k1 ,k2 from aggregate_table " --- .../org/apache/doris/planner/OlapScanNode.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fe/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/src/main/java/org/apache/doris/planner/OlapScanNode.java index 225b6965c7..153949eaba 100644 --- a/fe/src/main/java/org/apache/doris/planner/OlapScanNode.java +++ b/fe/src/main/java/org/apache/doris/planner/OlapScanNode.java @@ -443,6 +443,13 @@ public class OlapScanNode extends ScanNode { localBeId = Catalog.getCurrentSystemInfo().getBackendIdByHost(FrontendOptions.getLocalHostAddress()); } + /** + * Reset the tablet and scan range info before compute it. + * The old rollup selector has computed tablet and scan range info. + * Then the new mv selector maybe compute tablet and scan range info again sometimes. + * So, we need to reset those info in here. + */ + resetTabletAndScanRangeInfo(); for (Long partitionId : selectedPartitionIds) { final Partition partition = olapTable.getPartition(partitionId); final MaterializedIndex selectedTable = partition.getIndex(selectedIndexId); @@ -471,6 +478,17 @@ public class OlapScanNode extends ScanNode { } } + private void resetTabletAndScanRangeInfo() { + scanTabletIds = Lists.newArrayList(); + tabletId2BucketSeq = Maps.newHashMap(); + bucketSeq2locations = ArrayListMultimap.create(); + totalTabletsNum = 0; + selectedTabletsNum = 0; + cardinality = 0; + totalBytes = 0; + result = Lists.newArrayList(); + } + /** * We query Palo Meta to get request's data location * extra result info will pass to backend ScanNode