Skip to content

Commit

Permalink
Supplement createOperator Parser Rule (#30679)
Browse files Browse the repository at this point in the history
* Change1 DDLStatement.g4

* create-operator.xml

* Change1 case
  • Loading branch information
zhuruixuan authored Mar 28, 2024
1 parent 8bb9bc4 commit 9385008
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 9385008

Please sign in to comment.