hello-stephen commented on code in PR #70408:
URL: https://github.com/apache/doris/pull/70408#discussion_r4763716952
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPlanUtil.java:
##########
@@ -468,7 +480,23 @@ public static List<ColumnDefinition> generateColumns(Plan
plan, ConnectContext c
} else {
colNames.add(colName);
}
- DataType dataType = getDataType(userSlot, i, ctx, partitionCol,
distributionColumnNames);
+ Slot slotForVariant = userSlot;
+ if (userSlot.getDataType().conversion() instanceof VariantType) {
+ Plan sourcePlan = analyzedPlan != null ? analyzedPlan : plan;
+ if (exprDefinitions == null) {
+ exprDefinitions =
VariantType.collectExprDefinitions(sourcePlan);
+ }
+ if (analyzedPlan != null) {
+ List<Slot> analyzedSlots = analyzedPlan.getOutput();
+ Preconditions.checkState(analyzedSlots.size() ==
userSlots.size(),
Review Comment:
[P2] Filter IVM hidden columns from analyzed outputs
With table streams enabled, use a changelog-enabled `(k INT, s STRING)`
source and create an MV with `REFRESH INCREMENTAL`, `ivm_force_mow=true` and
`SELECT k, parse_to_variant(s) AS pv`. `Analyzer` runs `IvmNormalizeMTMV`
before the analyzed snapshot is captured, producing this reduced plan:
```text
ResultSink(row_id, k, pv)
Project(row_id, k, parse_to_variant(s) AS pv)
Scan(src)
```
`generateColumns` filters the physical output to `userSlots=[k,pv]`, but
this check compares it with all three analyzed outputs. On `pv`, CREATE
therefore fails with `analyzed output size 3 does not match user output size
2`. The source has no VARIANT column, and the MV need not enable changelog, so
the changelog VARIANT restriction does not exclude this case. Filter the
analyzed outputs by the same IVM-hidden criteria before checking/indexing them,
and cover incremental MV creation with a computed VARIANT output.
--
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]