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 a9cf274 Fix capacity unit charset as alias. (#16496)
a9cf274 is described below
commit a9cf274baee53169fe944e9aa6e7f9366f0a74a8
Author: Chuxin Chen <[email protected]>
AuthorDate: Thu Mar 31 08:08:47 2022 +0800
Fix capacity unit charset as alias. (#16496)
* Fix capacity unit charset as alias.
* Fix capacity unit charset as alias.
---
.../src/main/antlr4/imports/oracle/BaseRule.g4 | 6 +++++-
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 2 +-
.../src/main/resources/case/dml/select.xml | 11 +++++++++++
.../src/main/resources/sql/supported/dml/select.xml | 1 +
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
index 37e00c1..4f60864 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/BaseRule.g4
@@ -97,7 +97,7 @@ unreservedWord
| SYSGUID | SYSBACKUP | SYSDBA | SYSDG | SYSKM | SYSOPER | DBA_RECYCLEBIN
|SCHEMA
| DO | DEFINER | CURRENT_USER | CASCADED | CLOSE | OPEN | NEXT | NAME |
NAMES
| COLLATION | REAL | TYPE | FIRST | RANK | SAMPLE | SYSTIMESTAMP |
INTERVAL | MINUTE | ANY
- | LENGTH | SINGLE_C
+ | LENGTH | SINGLE_C | capacityUnit
;
schemaName
@@ -1241,3 +1241,7 @@ libName
externalDatatype
: dataType
;
+
+capacityUnit
+ : ('K' | 'M' | 'G' | 'T' | 'P' | 'E')
+ ;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index a3d215c..608523d 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -529,7 +529,7 @@ storageClause
;
sizeClause
- : (NUMBER_ | INTEGER_) ('K' | 'M' | 'G' | 'T' | 'P' | 'E')?
+ : (NUMBER_ | INTEGER_) capacityUnit?
;
maxsizeClause
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
index 43e2de8..42f2af0 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
@@ -4248,6 +4248,17 @@
</from>
</select>
+ <select sql-case-id="select_table_with_capacity_unit_charset">
+ <from>
+ <simple-table name="T_RATION_INFO" alias="T" start-index="22"
stop-index="36" />
+ </from>
+ <projections start-index="7" stop-index="15">
+ <column-projection name="USER_NO" start-index="7" stop-index="15">
+ <owner name="T" start-index="7" stop-index="7" />
+ </column-projection>>
+ </projections>
+ </select>
+
<select sql-case-id="select_with_character_charset">
<projections start-index="7" stop-index="24">
<!-- TODO StringLiteralValue should consider about _binary/_utf8mb4-->
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
index 5b188d0..e51b4ff 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
@@ -120,5 +120,6 @@
<sql-case id="select_with_schema_name_in_table" value="SELECT order_id
FROM public.t_order WHERE user_id = ? AND order_id = ?"
db-types="PostgreSQL,openGauss" />
<sql-case id="select_with_database_name_and_schema_name_in_table"
value="SELECT order_id FROM sharding_db.public.t_order WHERE user_id = ? AND
order_id = ?" db-types="PostgreSQL,openGauss" />
<sql-case id="select_with_underscore_charset" value="SELECT _code,_a FROM
t_order" db-types="MySQL" />
+ <sql-case id="select_table_with_capacity_unit_charset" value="SELECT
T.USER_NO FROM T_RATION_INFO T" db-types="Oracle" />
<sql-case id="select_with_character_charset" value="SELECT _binary 'abc'
as a" db-types="MySQL" />
</sql-cases>