[ https://issues.apache.org/jira/browse/CALCITE-6007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765889#comment-17765889 ]
Wenrui Meng commented on CALCITE-6007: -------------------------------------- It's from sqlNode.unparse. SqlWith means the SqlWith node statement. {code:java} With name as (...) select * from name {code} > Sqlwith as subquery without alias doesn't have correct alias setup > ------------------------------------------------------------------ > > Key: CALCITE-6007 > URL: https://issues.apache.org/jira/browse/CALCITE-6007 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.34.0, 1.35.0 > Reporter: Wenrui Meng > Priority: Major > > {code:java} > SELECT > a, > b > FROM ( > WITH > sub AS ( > SELECT > 1 AS a, > 2 AS b) > SELECT > * > FROM > sub) > WHERE > a IS NOT null > {code} > It will generate the following SQL statement after validation > {code:java} > SELECT > EXPR$0.a, > EXPR$0.b > FROM ( > WITH > sub AS ( > SELECT > 1 AS a, > 2 AS b) > SELECT > sub.a AS a, sub.b AS b > FROM > sub) > WHERE > EXPR$0.a IS NOT null > {code} > The validated SQL become invalid since there is no EXPR$0 alias append for > the SqlWith sub query but used in the expression outside. -- This message was sent by Atlassian Jira (v8.20.10#820010)