This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 9385008f808 Supplement createOperator Parser Rule (#30679)
9385008f808 is described below

commit 9385008f808599cc3901b964a747b5f5e03a830a
Author: zhuruixuan <[email protected]>
AuthorDate: Thu Mar 28 16:28:31 2024 +0800

    Supplement createOperator Parser Rule (#30679)
    
    * Change1 DDLStatement.g4
    
    * create-operator.xml
    
    * Change1 case
---
 .../src/main/antlr4/imports/oracle/DDLStatement.g4     | 18 +++++++++++++++++-
 .../src/main/resources/case/ddl/create-operator.xml    |  1 +
 .../resources/sql/supported/ddl/create-operator.xml    |  1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

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 0588b3e7cfd..1f9ed4a60b4 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
@@ -52,13 +52,29 @@ bindDefinition
     ;
 
 returnDefinition
-    : RETURN returnTypeDef implementsOperator
+    : RETURN returnTypeDef operatorBindClause? implementsOperator
     ;
 
 implementsOperator
     : USING functionNameDef
     ;
 
+operatorBindClause
+    : withIndexContextDef COMMA_ scanContextDef primaryBindingDef?
+    ;
+
+primaryBindingDef
+    : COMPUTE ANCILLARY DATA
+    ;
+
+scanContextDef
+    : SCAN CONTEXT identifier
+    ;
+
+withIndexContextDef
+   : WITH INDEX CONTEXT
+   ;
+
 returnTypeDef
     : dataType
     ;
diff --git a/test/it/parser/src/main/resources/case/ddl/create-operator.xml 
b/test/it/parser/src/main/resources/case/ddl/create-operator.xml
index 955eab01d81..b6538526970 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-operator.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-operator.xml
@@ -23,4 +23,5 @@
     <create-operator sql-case-id="create_operator_with_schema_qualified_name" 
/>
     <create-operator sql-case-id="create_operator_with_binding" />
     <create-operator 
sql-case-id="create_operator_with_binding_custom_datatype" />
+    <create-operator sql-case-id="create_operator_with_compute_ancillary_data" 
/>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/ddl/create-operator.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/create-operator.xml
index 4e7ef81c7eb..542b666b291 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-operator.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-operator.xml
@@ -23,4 +23,5 @@
     <sql-case id="create_operator_with_schema_qualified_name" value="CREATE 
OPERATOR alter1.= (PROCEDURE = alter1.same, LEFTARG  = alter1.ctype, RIGHTARG = 
alter1.ctype)" db-types="PostgreSQL" />
     <sql-case id="create_operator_with_binding" value="CREATE OPERATOR 
Contains BINDING (VARCHAR2, VARCHAR2) RETURN NUMBER USING TextContains;" 
db-types="Oracle" />
     <sql-case id="create_operator_with_binding_custom_datatype" value="CREATE 
OPERATOR Contains BINDING (VARCHAR2, VARCHAR2) RETURN NUMBER USING 
text.contains, (Spatial.Geo, Spatial.Geo) RETURN NUMBER USING 
Spatial.contains;" db-types="Oracle" />
+    <sql-case id="create_operator_with_compute_ancillary_data" value="CREATE 
OPERATOR Contains BINDING (VARCHAR2, VARCHAR2) RETURN NUMBER WITH INDEX 
CONTEXT, SCAN CONTEXT TextIndexMethods COMPUTE ANCILLARY DATA USING 
TextContains;" db-types="Oracle" />
 </sql-cases>

Reply via email to