YufeiLiu created FLINK-18111:
--------------------------------

             Summary: LATERAL query failed when use create view syntax
                 Key: FLINK-18111
                 URL: https://issues.apache.org/jira/browse/FLINK-18111
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
    Affects Versions: 1.11.0
            Reporter: YufeiLiu


When execute sql like this will throw exception 
"org.apache.calcite.sql.validate.SqlValidatorException: Column 'c1' not found 
in any table":

{code:SQL}
CREATE VIEW my_view AS SELECT T.a, T.b FROM source, LATERAL 
TABLE(MY_TABLE_FUNCTION(`c1`)) AS T(`a`, `b`)
{code}

Because of in {{SqlToOperationConverter#convertCreateView}} unparse SqlNode to 
sql string after validate, but the LATERAL keyword was missing at this point. 
Plus {{SqlNode validateQuery = flinkPlanner.validate(query)}}, query == 
validateQuery.
I think we could use original sql to build {{CatalogViewImpl}}, they have the 
same functionality.





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

Reply via email to