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 ff9c2b95abc Support OpenGauss INET function (#28229)
ff9c2b95abc is described below
commit ff9c2b95abc3060865b7fdd98a8b441362b745fe
Author: Zichao <[email protected]>
AuthorDate: Thu Aug 24 17:47:39 2023 +1200
Support OpenGauss INET function (#28229)
* Support OpenGauss INET function
* Support OpenGauss INET function
---
.../src/main/antlr4/imports/opengauss/BaseRule.g4 | 1 +
.../src/main/resources/case/dml/select-expression.xml | 16 ++++++++++++++++
.../resources/sql/supported/dml/select-expression.xml | 1 +
.../src/main/resources/sql/unsupported/unsupported.xml | 1 -
4 files changed, 18 insertions(+), 1 deletion(-)
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 0ff56b2d082..461e3749894 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
@@ -439,6 +439,7 @@ unreservedWord
| ZONE
| JSON
| POSITION
+ | INET
;
typeFuncNameKeyword
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 b0e3c5e7b65..eabf816d6a5 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
@@ -2937,4 +2937,20 @@
</subquery-table>
</from>
</select>
+
+ <select sql-case-id="select_inet_function">
+ <projections start-index="7" stop-index="55">
+ <expression-projection start-index="7" stop-index="55"
alias="RESULT" text="inet '192.168.1.5' = inet '192.168.1.5'">
+ <binary-operation-expression start-index="7" stop-index="47">
+ <left>
+ <function function-name="inet" start-index="7"
stop-index="27" text="inet '192.168.1.5'" />
+ </left>
+ <operator>=</operator>
+ <right>
+ <function function-name="inet" start-index="30"
stop-index="47" 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 dc89c856644..9137c2f3fda 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
@@ -123,4 +123,5 @@
<sql-case id="select_prediction_function" value="SELECT cust_gender FROM
mining_data_apply_v WHERE PREDICTION (nb_sh_clas_sample COST MODEL AUTO USING
cust_marital_status, aeducation, household_size) = 1;" db-types="Oracle" />
<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-cases>
diff --git a/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
b/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
index 0da27863a01..d07df149600 100644
--- a/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
+++ b/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
@@ -129,7 +129,6 @@
<sql-case id="unsupported_select_case_for_opengauss_120" value="select
nullif(+,-) from sys_dummy;" db-types="openGauss" />
<sql-case id="unsupported_select_case_for_opengauss_121" value="select
nullif(!,~) from sys_dummy;" db-types="openGauss" />
<sql-case id="unsupported_select_case_for_opengauss_127" value="select
row_to_json(row(interval '3' day)) from sys_dummy;" db-types="openGauss" />
- <sql-case id="unsupported_select_case_for_opengauss_128" value="select
row_to_json(row(inet('10.183.187.233'))) from sys_dummy;" db-types="openGauss"
/>
<sql-case id="unsupported_select_case_for_opengauss_129" value="select
row_to_json(row(B'101')) from sys_dummy;" db-types="openGauss" />
<sql-case id="unsupported_select_case_for_opengauss_130" value="select
row_to_json(row('The Fat Rats'::tsvector)) from sys_dummy;"
db-types="openGauss" />
<sql-case id="unsupported_select_case_for_opengauss_132" value="select
array_prepend(@,array[1,2]) as result;" db-types="openGauss" />