[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 "
This commit is contained in:
EmmyMiao87
2020-02-27 18:19:34 +08:00
committed by GitHub
parent 3b5a0b6060
commit bd23f2cda2

View File

@ -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