morrySnow commented on code in PR #66472:
URL: https://github.com/apache/doris/pull/66472#discussion_r3795832621
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java:
##########
@@ -932,22 +928,25 @@ public Optional<ScoreRangeInfo> getScoreRangeInfo() {
return scoreRangeInfo;
}
- private List<SlotReference> createSlotsVectorized(List<Column> columns,
boolean skipBinlogBeforeColumn) {
+ protected List<SlotReference> createSlotsVectorized(List<Column> columns) {
List<String> qualified = qualified();
SlotReference[] slots = new SlotReference[columns.size()];
IdGenerator<ExprId> exprIdGenerator =
StatementScopeIdGenerator.getExprIdGenerator();
for (int i = 0; i < columns.size(); i++) {
- if (skipBinlogBeforeColumn &&
columns.get(i).getName().startsWith(Column.BINLOG_BEFORE_PREFIX)) {
- continue;
- }
ExprId nextId = exprIdGenerator.getNextId();
- slots[i] = SlotReference.fromColumn(nextId, table, columns.get(i),
qualified);
+ slots[i] = SlotReference.fromColumn(nextId, table,
getOutputColumn(columns.get(i)), qualified);
}
return Arrays.asList(slots);
}
- protected List<SlotReference> createSlotsVectorized(List<Column> columns) {
- return createSlotsVectorized(columns, false);
+ private Column getOutputColumn(Column column) {
+ if (scanParams.isPresent() && scanParams.get().incrementalRead()
+ && column.getName().startsWith(Column.BINLOG_BEFORE_PREFIX)) {
+ Column outputColumn = new Column(column);
+ outputColumn.setIsVisible(false);
+ return outputColumn;
Review Comment:
add comment to explain why need to set to invisible
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -3124,13 +3133,146 @@ static void
preserveConnectorMustReadSlots(PluginDrivenScanNode scanNode, Set<Sl
}
}
+ /**
+ * Add columns required by storage merge semantics to the physical scan
tuple. These slots are
+ * deliberately separate from {@code extra_key_column_slot_ids}: storage
semantic dependencies
+ * must always read their real values.
+ */
+ private void preserveStorageSemanticSlots(OlapScanNode scanNode,
Set<SlotId> requiredSlotIds,
+ boolean requireSequenceForLazyMaterialization) {
+ if (scanNode.getOlapTable() instanceof RowBinlogTableWrapper
+ && scanNode.getScanParams() != null
+ && scanNode.getScanParams().incrementalRead()) {
+ preserveRowBinlogSemanticSlots(scanNode, requiredSlotIds);
+ return;
+ }
+ if (scanNode.getOlapTable() instanceof OlapTableWrapper
+ && !(scanNode.getOlapTable() instanceof
RowBinlogTableWrapper)) {
+ preserveSnapshotCommitTsoSlot(scanNode, requiredSlotIds);
+ }
+ preserveMergeSequenceSlots(scanNode, requiredSlotIds,
requireSequenceForLazyMaterialization);
+ }
+
+ private void preserveSnapshotCommitTsoSlot(OlapScanNode scanNode,
Set<SlotId> requiredSlotIds) {
Review Comment:
Add an individual comment for each preserve, clearly explaining why it is
needed and what scenario it serves.
--
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]