Vladsz83 commented on code in PR #11467:
URL: https://github.com/apache/ignite/pull/11467#discussion_r1734855287


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlCustomParserTest.java:
##########
@@ -687,6 +690,78 @@ public void dropUser() throws Exception {
         assertParserThrows("drop user test with password 'asd'", 
SqlParseException.class);
     }
 
+    /**
+     * Tests that CREATE OR REPLACE is not allowed for CREATE TABLE/INDEX/USER.
+     */
+    @Test
+    public void invalidCreateOrReplace() {
+        assertParserThrows("create or replace table my_table(id int, val 
varchar)", SqlParseException.class,
+            "Unsupported clause 'REPLACE'");
+
+        assertParserThrows("create or replace index my_index on my_table(id)", 
SqlParseException.class,
+            "Unsupported clause 'REPLACE'");
+
+        assertParserThrows("create or replace user test with password 'asd'", 
SqlParseException.class,
+            "Unsupported clause 'REPLACE'");
+    }
+
+    /**
+     * Create view.
+     */
+    @Test
+    public void createView() throws SqlParseException {
+        SqlCreateView createView = parse("create view my_view as select * from 
my_table");
+
+        assertThat(createView.name.names, is(ImmutableList.of("MY_VIEW")));
+        assertThat(createView.getReplace(), is(false));
+        assertThat(createView.query, instanceOf(SqlSelect.class));
+        assertThat(((SqlSelect)createView.query).getFrom().toString(), 
is("MY_TABLE"));

Review Comment:
   We could also check `query.hints` and make a test for it.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to