TsukiokaKogane commented on code in PR #63850:
URL: https://github.com/apache/doris/pull/63850#discussion_r3341225813
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeOlapTableStreamScan.java:
##########
@@ -72,49 +113,125 @@ public Plan
visitLogicalOlapTableStreamScan(LogicalOlapTableStreamScan scan, Voi
&& ((SlotReference)
slot).getOriginalColumn().isPresent()
&& ((SlotReference) slot).getOriginalColumn().get()
.equals(Column.STREAM_SEQ_VIRTUAL_COLUMN)))
- .collect(Collectors.toList());
+ .collect(Collectors.toList()));
- if (originSlots.equals(newSlots)) {
- return scan;
- }
-
- // add delete sign column if unique base table
- Slot deleteSlot = null;
- for (Column column : scan.getTable().getBaseSchema(true)) {
- if (column.getName().equals(Column.DELETE_SIGN)) {
- deleteSlot =
SlotReference.fromColumn(StatementScopeIdGenerator.newExprId(), scan.getTable(),
- column, scan.qualified());
- newSlots.add(deleteSlot);
- break;
+ // history plan
+ if (!historicalPartitionIds.isEmpty()) {
+ List<Slot> scanSlots = new ArrayList<>(newSlots);
+ // add delete sign column if unique base table
+ Slot deleteSlot = null;
+ for (Column column : scan.getTable().getBaseSchema(true)) {
+ if (column.getName().equals(Column.DELETE_SIGN)) {
+ deleteSlot =
SlotReference.fromColumn(StatementScopeIdGenerator.newExprId(), scan.getTable(),
+ column, scan.qualified());
+ scanSlots.add(deleteSlot);
+ break;
+ }
}
- }
- Plan plan = scan.withCachedOutput(newSlots);
- if (deleteSlot != null) {
- Expression conjunct = new EqualTo(deleteSlot, new
TinyIntLiteral((byte) 0));
- if (!scan.getTable().getEnableUniqueKeyMergeOnWrite()) {
- plan = scan.withPreAggStatus(PreAggStatus.off(
- Column.DELETE_SIGN + " is used as conjuncts."));
+ Plan plan =
scan.withSelectedPartitionIds(historicalPartitionIds, true)
+ .withCachedOutput(new ArrayList<>(scanSlots))
+ .withNormalized(true);
+ if (deleteSlot != null) {
+ Expression conjunct = new EqualTo(deleteSlot, new
TinyIntLiteral((byte) 0));
+ if (!scan.getTable().getEnableUniqueKeyMergeOnWrite()) {
+ plan = scan.withPreAggStatus(PreAggStatus.off(
Review Comment:
will fix it
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java:
##########
@@ -230,7 +237,8 @@ public PhysicalOlapScan withPartitionPrunablePredicates(
selectedIndexId, selectedTabletIds, selectedPartitionIds,
hasPartitionPredicate,
distributionSpec, preAggStatus, baseOutputs, groupExpression,
getLogicalProperties(),
getPhysicalProperties(), statistics, tableSample,
operativeSlots, virtualColumns, scoreOrderKeys,
- scoreLimit, scoreRangeInfo, annOrderKeys, annLimit,
tableAlias, partitionPrunablePredicates));
+ scoreLimit, scoreRangeInfo, annOrderKeys, annLimit,
tableAlias, partitionPrunablePredicates, false,
Review Comment:
will fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]