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

chengzhang 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 b7df3101f74 Support OpenGauss INET function symbols (#28250)
b7df3101f74 is described below

commit b7df3101f743cc3060c5524ea2fb9f57df86cbcf
Author: Zichao <[email protected]>
AuthorDate: Thu Aug 24 22:15:14 2023 +1200

    Support OpenGauss INET function symbols (#28250)
---
 .../src/main/antlr4/imports/opengauss/BaseRule.g4        |  5 +++++
 .../src/main/antlr4/imports/opengauss/Symbol.g4          |  2 ++
 .../src/main/resources/case/dml/select-expression.xml    | 16 ++++++++++++++++
 .../resources/sql/supported/dml/select-expression.xml    |  1 +
 4 files changed, 24 insertions(+)

diff --git 
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
index 461e3749894..603b694b7b0 100644
--- a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
+++ b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
@@ -540,6 +540,10 @@ comparisonOperator
     : EQ_ | GTE_ | GT_ | LTE_ | LT_ | NEQ_
     ;
 
+inetOperator
+    : SIGNED_LEFT_SHIFT_ | SIGNED_LEFT_SHIFT_E_ | SIGNED_RIGHT_SHIFT_ | 
SIGNED_RIGHT_SHIFT_E_
+    ;
+
 patternMatchingOperator
     : LIKE
     | TILDE_TILDE_
@@ -580,6 +584,7 @@ aExpr
     | qualOp aExpr
     | aExpr qualOp
     | aExpr comparisonOperator aExpr
+    | aExpr inetOperator aExpr
     | NOT aExpr
     | aExpr patternMatchingOperator aExpr ESCAPE aExpr
     | aExpr patternMatchingOperator aExpr
diff --git 
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/Symbol.g4 
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/Symbol.g4
index a509bbbaef3..4aac8faf973 100644
--- a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/Symbol.g4
+++ b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/Symbol.g4
@@ -88,3 +88,5 @@ GEOMETRIC_ABOVE_:               '>^';
 GEOMETRIC_INTERSECT_:           '?#';
 GEOMETRIC_PERPENDICULAR_:       '?-|';
 GEOMETRIC_SAME_AS_:             '~=';
+SIGNED_LEFT_SHIFT_E_:           '<<=';
+SIGNED_RIGHT_SHIFT_E_:          '>>=';
diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml 
b/test/it/parser/src/main/resources/case/dml/select-expression.xml
index eabf816d6a5..5084eff3d6f 100644
--- a/test/it/parser/src/main/resources/case/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml
@@ -2953,4 +2953,20 @@
             </expression-projection>
         </projections>
     </select>
+    
+    <select sql-case-id="select_inet_function_with_inet_operator">
+        <projections start-index="7" stop-index="57">
+            <expression-projection start-index="7" stop-index="57" 
alias="RESULT" text="inet '192.168.1.5' &lt;&lt;= inet '192.168.1.5'">
+                <binary-operation-expression start-index="7" stop-index="49">
+                    <left>
+                        <function function-name="inet" start-index="7" 
stop-index="27" text="inet '192.168.1.5'" />
+                    </left>
+                    <operator>&lt;&lt;=</operator>
+                    <right>
+                        <function function-name="inet" start-index="32" 
stop-index="49" text="inet '192.168.1.5'" />
+                    </right>
+                </binary-operation-expression>
+            </expression-projection>
+        </projections>
+    </select>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml 
b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
index 9137c2f3fda..92b4d81412e 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
@@ -124,4 +124,5 @@
     <sql-case id="select_prediction_details_function" value="SELECT 
PREDICTION_DETAILS(DT_SH_Clas_sample using *) FROM mining_data_apply_v WHERE 
occupation = 'TechSup'" db-types="Oracle" />
     <sql-case id="select_predict_by_function" value="SELECT PREDICT BY 
point_kmeans (FEATURES position) as pos FROM (select * from kmeans_2d limit 
10);" db-types="openGauss" />
     <sql-case id="select_inet_function" value="SELECT inet '192.168.1.5' = 
inet '192.168.1.5' AS RESULT;" db-types="openGauss" />
+    <sql-case id="select_inet_function_with_inet_operator" value="SELECT inet 
'192.168.1.5' &lt;&lt;= inet '192.168.1.5' AS RESULT;" db-types="openGauss" />
 </sql-cases>

Reply via email to