diff --git a/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/transformer/QueryTransformer.java b/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/transformer/QueryTransformer.java index 9ef32c458c5db..1078abae1f9ea 100644 --- a/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/transformer/QueryTransformer.java +++ b/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/transformer/QueryTransformer.java @@ -249,6 +249,7 @@ private OptExprBuilder projectForOrder(OptExprBuilder subOpt, outputTranslations.addExpressionToColumns(subOpt.getExpressionMapping().getExpressionToColumns()); outputTranslations.addColumnRefToConstOperators(subOpt.getColumnRefToConstOperators()); + outputTranslations.addGeneratedColumnExprOpToColumnRef(subOpt.getGeneratedColumnExprOpToColumnRef()); LogicalProjectOperator projectOperator = new LogicalProjectOperator(projections); return new OptExprBuilder(projectOperator, Lists.newArrayList(subOpt), outputTranslations); @@ -282,6 +283,7 @@ private OptExprBuilder project(OptExprBuilder subOpt, Iterable expressions outputTranslations.addExpressionToColumns(subOpt.getExpressionMapping().getExpressionToColumns()); outputTranslations.addColumnRefToConstOperators(subOpt.getColumnRefToConstOperators()); + outputTranslations.addGeneratedColumnExprOpToColumnRef(subOpt.getGeneratedColumnExprOpToColumnRef()); LogicalProjectOperator projectOperator = new LogicalProjectOperator(projections, limit); return new OptExprBuilder(projectOperator, Lists.newArrayList(subOpt), outputTranslations);