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 7fe33e7fc6e Support OpenGauss number manipulation functions parse
(#28322)
7fe33e7fc6e is described below
commit 7fe33e7fc6e5e2af4e878d15470d6cef93462e10
Author: Zichao <[email protected]>
AuthorDate: Fri Sep 1 11:26:19 2023 +1200
Support OpenGauss number manipulation functions parse (#28322)
---
.../opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 | 5 +++++
.../src/main/antlr4/imports/opengauss/OpenGaussKeyword.g4 | 8 ++++++++
test/it/parser/src/main/resources/case/dml/select-expression.xml | 8 ++++++++
.../src/main/resources/sql/supported/dml/select-expression.xml | 1 +
4 files changed, 22 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 63cca97bb1d..1e1491a7cc1 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
@@ -440,6 +440,11 @@ unreservedWord
| JSON
| POSITION
| INET
+ | INT1
+ | INT2
+ | INT4
+ | INT16
+ | FLOAT4
;
typeFuncNameKeyword
diff --git
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/OpenGaussKeyword.g4
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/OpenGaussKeyword.g4
index 37e3d6d637d..d5e00615524 100644
---
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/OpenGaussKeyword.g4
+++
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/OpenGaussKeyword.g4
@@ -1408,3 +1408,11 @@ FEATURES
TS_REWRITE
: T S UL_ R E W R I T E
;
+
+INT16
+ : I N T [16]
+ ;
+
+INT1
+ : I N T [1]
+ ;
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 73e21de33b3..df35a1534b0 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
@@ -2977,4 +2977,12 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_int_2_function">
+ <projections start-index="7" stop-index="16">
+ <expression-projection start-index="7" stop-index="16"
text="int2(25.3)">
+ <function start-index="7" stop-index="16" text="int2(25.3);"
function-name="int2" />
+ </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 42a0daee493..93fcb009f37 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
@@ -126,4 +126,5 @@
<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' <<= inet '192.168.1.5' AS RESULT;" db-types="openGauss" />
<sql-case id="select_ts_rewrite_function" value="SELECT ts_rewrite('a
& b'::tsquery, 'a'::tsquery, 'c'::tsquery);" db-types="openGauss" />
+ <sql-case id="select_int_2_function" value="select int2(25.3);"
db-types="openGauss" />
</sql-cases>