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_r410056208
##########
File path:
flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserImplTest.java
##########
@@ -714,10 +714,30 @@ public void testCreateViewWithInvalidName() {
sql(sql).fails(expected);
}
+ @Test
+ public void testCreateTemporaryView() {
+ final String sql = "create temporary view v as select col1 from
tbl";
+ final String expected = "CREATE TEMPORARY VIEW `V`\n" +
+ "AS\n" +
+ "SELECT `COL1`\n" +
+ "FROM `TBL`";
+ sql(sql).ok(expected);
+ }
+
+ @Test
+ public void testCreateViewIfNotExists() {
+ final String sql = "create view if not exists v as select col1
from tbl";
+ final String expected = "CREATE VIEW IF NOT EXISTS `V`\n" +
+ "AS\n" +
+ "SELECT `COL1`\n" +
+ "FROM `TBL`";
+ sql(sql).ok(expected);
+ }
+
@Test
public void testDropView() {
- final String sql = "DROP VIEW IF EXISTS view_name";
- final String expected = "DROP VIEW IF EXISTS `VIEW_NAME`";
+ final String sql = "DROP TEMPORARY VIEW IF EXISTS view_name";
Review comment:
add a new case named `testTemporaryDropView`
----------------------------------------------------------------
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