godfreyhe commented on a change in pull request #11727: [FLINK-17106][table] Support create and drop view in Flink SQL URL: https://github.com/apache/flink/pull/11727#discussion_r410708396
########## File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/operations/SqlToOperationConverter.java ########## @@ -456,6 +468,59 @@ private Operation convertAlterDatabase(SqlAlterDatabase sqlAlterDatabase) { return new AlterDatabaseOperation(catalogName, databaseName, catalogDatabase); } + /** Convert CREATE VIEW statement. */ + private Operation convertCreateView(SqlCreateView sqlCreateView) { + final SqlNode query = sqlCreateView.getQuery(); + final SqlNodeList fieldList = sqlCreateView.getFieldList(); + + SqlNode validateQuery = flinkPlanner.validate(query); + PlannerQueryOperation operation = toQueryOperation(flinkPlanner, validateQuery); + TableSchema schema = operation.getTableSchema(); + + if (!fieldList.getList().isEmpty()) { Review comment: I think it's better add some comments here or an example, I doubt this because most people are familiar with "create view ..." without alias. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services