github-actions[bot] commented on code in PR #64413:
URL: https://github.com/apache/doris/pull/64413#discussion_r3434488609
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -1001,6 +1024,79 @@ private PlanFragment
computePhysicalOlapScan(PhysicalOlapScan olapScan, PlanTran
return planFragment;
}
+ private StorageAlignedScanSlots
computeStorageAlignedScanSlots(PhysicalOlapScan olapScan) {
+ if (!shouldAlignScanSlotsToStorageSchema(olapScan)) {
+ return new StorageAlignedScanSlots(olapScan.getOutput(),
Collections.emptySet());
+ }
+
+ Set<ExprId> outputExprIds = olapScan.getOutput().stream()
+ .map(Slot::getExprId)
+ .collect(Collectors.toSet());
+ Map<Integer, Slot> slotByColumnUniqueId = new HashMap<>();
+ Map<String, Slot> slotByColumnName = new HashMap<>();
+ Stream.concat(olapScan.getSelectedIndexOutputs().stream(),
olapScan.getOutput().stream())
+ .forEach(slot -> {
+ Optional<Column> originalColumn = ((SlotReference)
slot).getOriginalColumn();
+ if (originalColumn.isPresent()) {
+ Column column = originalColumn.get();
+ if (column.getUniqueId() ==
Column.COLUMN_UNIQUE_ID_INIT_VALUE) {
+ slotByColumnName.put(column.getName(), slot);
+ } else {
+ slotByColumnUniqueId.put(column.getUniqueId(),
slot);
+ }
+ }
+ });
+
+ List<Slot> storageSlots = new ArrayList<>();
+ Set<ExprId> storageExprIds = new HashSet<>();
+ Set<ExprId> filledKeyExprIds = new HashSet<>();
+ long selectedIndexId = olapScan.getSelectedIndexId() == -1
+ ? olapScan.getTable().getBaseIndexId()
+ : olapScan.getSelectedIndexId();
+ for (Column column :
olapScan.getTable().getSchemaByIndexId(selectedIndexId, true)) {
+ if (!column.isKey()) {
Review Comment:
This alignment runs before `computePhysicalOlapScan` replaces incremental
scans with `RowBinlogTableWrapper`. For an `OlapTableStreamWrapper` over an AGG
or non-MOW UNIQUE table, `shouldAlignScanSlotsToStorageSchema()` returns true
against the base table, then this calls the two-argument
`getSchemaByIndexId(indexId, true)` overload on the stream wrapper.
`OlapTableStreamWrapper` only overrides the one-argument overload, and its
inherited `indexIdToMeta` is not populated by the wrapper constructor, so
planning an incremental stream scan can fail here before the row-binlog scan
node is built. Incremental/row-binlog scans should skip this storage-key
alignment, or the alignment should be computed only after switching to the
row-binlog table/schema.
--
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]