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_r410068472
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/internal/TableEnvImpl.scala
##########
@@ -632,6 +632,31 @@ abstract class TableEnvImpl(
case useDatabaseOperation: UseDatabaseOperation =>
catalogManager.setCurrentCatalog(useDatabaseOperation.getCatalogName)
catalogManager.setCurrentDatabase(useDatabaseOperation.getDatabaseName)
+ case createViewOperation: CreateViewOperation =>
+ if (createViewOperation.isTemporary) {
+ catalogManager.createTemporaryTable(
+ createViewOperation.getCatalogView,
+ createViewOperation.getViewIdentifier,
+ createViewOperation.isIgnoreIfExists)
+ } else {
+ catalogManager.createTable(
+ createViewOperation.getCatalogView,
+ createViewOperation.getViewIdentifier,
+ createViewOperation.isIgnoreIfExists)
+ }
+ case dropViewOperation: DropViewOperation =>
+ if (dropViewOperation.isTemporary) {
+ val dropped =
catalogManager.dropTemporaryView(dropViewOperation.getViewIdentifier)
+ if (!dropped && !dropViewOperation.isIfExists) {
+ throw new ValidationException(String.format(
+ "Temporary views with identifier %s doesn't exist",
Review comment:
ditto
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services