[ 
https://issues.apache.org/jira/browse/CALCITE-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125253#comment-17125253
 ] 

Rui Wang commented on CALCITE-4039:
-----------------------------------

Will it it helpful to 
1. still goes through the validation.
2. but get the SQL query by unparsing un-validated SqlNode.

Basically unparsing from un-validated SqlNode could be relatively robust as 
SqlParserTest and SqlUnparserTest provide test coverage on SQL syntax.




> Missing LATERAL keyword after sql validate
> ------------------------------------------
>
>                 Key: CALCITE-4039
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4039
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.23.0
>            Reporter: YufeiLiu
>            Priority: Major
>
> I tried format to sql string after validate SqlNode, but the {{LATERAL}} 
> keyword was missing in the result.
> original sql:
> {code:sql}
> SELECT `B`, `C`, `D`, `E`
> FROM `source_table`,
> LATERAL TABLE(`MY_TABLE_FUNCTION`(`A`)) AS `T` (`B`, `C`, `D`, `E`)
> {code}
> validated sql:
> {code:sql}
> SELECT `B`, `C`, `D`, `E`
> FROM `source_table`,
> TABLE(`MY_TABLE_FUNCTION`(`A`)) AS `T` (`B`, `C`, `D`, `E`)
> {code}
> In {{SqlValidatorImpl}}, only return newOperand and missing the LATERAL 
> operator.
> {code:java}
>    case LATERAL:
>       return registerFrom(
>           parentScope,
>           usingScope,
>           register,
>           ((SqlCall) node).operand(0),
>           enclosingNode,
>           alias,
>           extendList,
>           forceNullable,
>           true);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to