[fix](Nereids) deep copier generate wrong slot for TVF (#25156)

This commit is contained in:
morrySnow
2023-10-09 14:52:36 +08:00
committed by GitHub
parent d34ab7accc
commit cdba4c4775
3 changed files with 9 additions and 1 deletions

View File

@ -229,7 +229,7 @@ public class LogicalPlanDeepCopier extends DefaultPlanRewriter<DeepCopierContext
}
LogicalTVFRelation newTVFRelation = new LogicalTVFRelation(StatementScopeIdGenerator.newRelationId(),
tvfRelation.getFunction());
updateReplaceMapWithOutput(newTVFRelation, tvfRelation, context.exprIdReplaceMap);
updateReplaceMapWithOutput(tvfRelation, newTVFRelation, context.exprIdReplaceMap);
context.putRelation(tvfRelation.getRelationId(), newTVFRelation);
return newTVFRelation;
}

View File

@ -30,3 +30,8 @@
2
3
-- !tvf_in_cte --
0
1
2

View File

@ -48,5 +48,8 @@ suite("test_with") {
SELECT * FROM outermost ORDER BY 1;
"""
order_qt_tvf_in_cte """
with a as (select number from numbers("number"="3")) select * from a;
"""
}