From e25b202b16ee7e70227ff7f2a920636f0c5dabd6 Mon Sep 17 00:00:00 2001 From: niu niu Date: Sat, 18 Nov 2023 17:27:29 +0800 Subject: [PATCH] Fix oracle create view parse rule --- .../antlr4/imports/oracle/DDLStatement.g4 | 4 +- .../main/resources/case/ddl/create-view.xml | 781 +++++++++++++++++- .../src/main/resources/case/dml/select.xml | 27 + .../sql/supported/ddl/create-view.xml | 25 +- .../resources/sql/supported/dml/select.xml | 1 + 5 files changed, 833 insertions(+), 5 deletions(-) diff --git a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 index c9cddf286cdcd..a0620e1440193 100644 --- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 +++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 @@ -22,8 +22,8 @@ import BaseRule, DCLStatement, DMLStatement; createView : CREATE (OR REPLACE)? (NO? FORCE)? (EDITIONING | EDITIONABLE EDITIONING? | NONEDITIONABLE)? VIEW viewName ( SHARING EQ_ (METADATA | DATA | EXTENDED DATA | NONE))? - ( LP_ (alias (VISIBLE | INVISIBLE)? inlineConstraint* (COMMA_ alias (VISIBLE | INVISIBLE)? inlineConstraint*)* - | outOfLineConstraint) RP_ | objectViewClause | xmlTypeViewClause)? + ( LP_ ((alias (VISIBLE | INVISIBLE)? inlineConstraint* | outOfLineConstraint) (COMMA_ (alias (VISIBLE | INVISIBLE)? inlineConstraint* | outOfLineConstraint))*) RP_ + | objectViewClause | xmlTypeViewClause)? ( DEFAULT COLLATION collationName)? (BEQUEATH (CURRENT_USER | DEFINER))? AS select subqueryRestrictionClause? ( CONTAINER_MAP | CONTAINERS_DEFAULT)? ; diff --git a/test/it/parser/src/main/resources/case/ddl/create-view.xml b/test/it/parser/src/main/resources/case/ddl/create-view.xml index b02db9f89450f..dd05e5686e3c2 100644 --- a/test/it/parser/src/main/resources/case/ddl/create-view.xml +++ b/test/it/parser/src/main/resources/case/ddl/create-view.xml @@ -273,6 +273,460 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/it/parser/src/main/resources/case/dml/select.xml b/test/it/parser/src/main/resources/case/dml/select.xml index 8a497f44e3cbc..fa588d4f47a62 100644 --- a/test/it/parser/src/main/resources/case/dml/select.xml +++ b/test/it/parser/src/main/resources/case/dml/select.xml @@ -7174,4 +7174,31 @@ + + diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/create-view.xml b/test/it/parser/src/main/resources/sql/supported/ddl/create-view.xml index c9c08280ff9f0..b48261a6313a8 100644 --- a/test/it/parser/src/main/resources/sql/supported/ddl/create-view.xml +++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-view.xml @@ -27,12 +27,33 @@ - + + + + + + + + + + + + + - + + + + + + + + + + diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select.xml b/test/it/parser/src/main/resources/sql/supported/dml/select.xml index 00db43c5587ca..cff56d26a3f10 100644 --- a/test/it/parser/src/main/resources/sql/supported/dml/select.xml +++ b/test/it/parser/src/main/resources/sql/supported/dml/select.xml @@ -217,4 +217,5 @@ +