This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 46769ed1a66 Remove unused mask DistSQL keyword ADDRESS_RANDOM_REPLACE
(#39363)
46769ed1a66 is described below
commit 46769ed1a66de8a712a45fbe7230898ccf4f8ef1
Author: Eunbin Son <[email protected]>
AuthorDate: Tue Sep 8 23:40:36 2026 +0900
Remove unused mask DistSQL keyword ADDRESS_RANDOM_REPLACE (#39363)
* Remove unused mask DistSQL keyword ADDRESS_RANDOM_REPLACE
* Instantiate mask DistSQL visitor directly in parser test
AGENTS.md forbids direct reflection APIs in tests. The visitor test
obtained the visitor through getDeclaredConstructor().newInstance(),
which also forced @SneakyThrows(ReflectiveOperationException.class).
Construct MaskDistSQLStatementVisitor directly and drop the now
unneeded @SneakyThrows. Parser assertions are unchanged.
* Move mask DistSQL keyword regression to parser IT
MaskDistSQLStatementVisitorTest verified the Keyword.g4 change through the
lexer, parser and visitor although this change does not touch
MaskDistSQLStatementVisitor, which would have made Mask the only module
keeping a local *StatementVisitorTest after #39465 and #39463 migrated the
equivalent coverage to parser IT.
Remove the module-local test and cover the removed keyword with one
CREATE MASK RULE case named address_random_replace in the shared parser
IT fixtures.
---------
Co-authored-by: Liang Zhang <[email protected]>
---
RELEASE-NOTES.md | 1 +
.../mask/distsql/parser/src/main/antlr4/imports/mask/Keyword.g4 | 4 ----
test/it/parser/src/main/resources/case/rdl/create.xml | 8 ++++++++
test/it/parser/src/main/resources/sql/supported/rdl/create.xml | 1 +
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 454412ced12..366c4201d21 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -42,6 +42,7 @@
1. Metadata: Fix wrong logic table metadata when config same actual table name
in different storage unit -
[#39157](https://github.com/apache/shardingsphere/pull/39157)
1. DistSQL: Fix case-sensitive storage unit matching in `SHOW RULES USED
STORAGE UNIT` - [#38848](https://github.com/apache/shardingsphere/pull/38848)
1. DistSQL: Use case-insensitive table name matching in broadcast create and
drop executors - [#39200](https://github.com/apache/shardingsphere/pull/39200)
+1. DistSQL: Remove unused ADDRESS_RANDOM_REPLACE keyword that reserved
identifiers in mask DistSQL -
[#39363](https://github.com/apache/shardingsphere/pull/39363)
1. DistSQL: Fix empty rows returned by SHOW SHADOW TABLE RULE for specified
table - [#39739](https://github.com/apache/shardingsphere/pull/39739)
1. DistSQL: Fix `CREATE READWRITE_SPLITTING RULE IF NOT EXISTS` failing for an
existing rule name -
[#39371](https://github.com/apache/shardingsphere/pull/39371)
1. DistSQL: Match mask table names case-insensitively in create and alter
executors - [#39361](https://github.com/apache/shardingsphere/pull/39361)
diff --git
a/features/mask/distsql/parser/src/main/antlr4/imports/mask/Keyword.g4
b/features/mask/distsql/parser/src/main/antlr4/imports/mask/Keyword.g4
index 510c5463171..e6e38db5cb2 100644
--- a/features/mask/distsql/parser/src/main/antlr4/imports/mask/Keyword.g4
+++ b/features/mask/distsql/parser/src/main/antlr4/imports/mask/Keyword.g4
@@ -135,10 +135,6 @@ GENERIC_TABLE_RANDOM_REPLACE
: G E N E R I C UL_ T A B L E UL_ R A N D O M UL_ R E P L A C E
;
-ADDRESS_RANDOM_REPLACE
- : A D D R E S S UL_ R A N D O M UL_ R E P L A C E
- ;
-
ALGORITHM
: A L G O R I T H M
;
diff --git a/test/it/parser/src/main/resources/case/rdl/create.xml
b/test/it/parser/src/main/resources/case/rdl/create.xml
index 826e95ef70e..1a520ecc062 100644
--- a/test/it/parser/src/main/resources/case/rdl/create.xml
+++ b/test/it/parser/src/main/resources/case/rdl/create.xml
@@ -752,6 +752,14 @@
</column>
</rule>
</create-mask-rule>
+
+ <create-mask-rule sql-case-id="create-mask-rule-named-as-removed-keyword">
+ <rule name="address_random_replace">
+ <column name="phone_number">
+ <algorithm algorithm-name="MD5"/>
+ </column>
+ </rule>
+ </create-mask-rule>
<create-sharding-key-generate-strategy
sql-case-id="create-sharding-key-generate-strategy-with-algorithm"
name="order_id_strategy">
<strategy type="COLUMN" table-name="t_order" column-name="order_id">
diff --git a/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
b/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
index 0de640a4bae..73e59f5d792 100644
--- a/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
@@ -80,6 +80,7 @@
<sql-case id="single-register-migration-source-storage-unit"
value="REGISTER MIGRATION SOURCE STORAGE UNIT ds_0
(URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456');"
db-types="ShardingSphere" />
<sql-case id="create-mask-rule" value="CREATE MASK RULE t_mask
(COLUMNS((NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y',
PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*'))),
(NAME=address,TYPE(NAME=MD5))));" db-types="ShardingSphere" />
<sql-case id="create-mask-rule-if-not-exists" value="CREATE MASK RULE IF
NOT EXISTS t_mask (COLUMNS((NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y',
PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*'))),
(NAME=address,TYPE(NAME=MD5))));" db-types="ShardingSphere" />
+ <sql-case id="create-mask-rule-named-as-removed-keyword" value="CREATE
MASK RULE address_random_replace
(COLUMNS((NAME=phone_number,TYPE(NAME=MD5))));" db-types="ShardingSphere" />
<sql-case id="create-sharding-key-generate-strategy-with-algorithm"
value="CREATE SHARDING KEY GENERATE STRATEGY order_id_strategy (TABLE=t_order,
COLUMN=order_id, TYPE(NAME='snowflake', PROPERTIES('worker-id'=1)))"
db-types="ShardingSphere" />
<sql-case id="create-sharding-key-generator" value="CREATE SHARDING KEY
GENERATOR snowflake_generator (TYPE(NAME='SNOWFLAKE', PROPERTIES('worker-id'=1,
' foo_key '=' bar_value ')))" db-types="ShardingSphere" />
<sql-case id="create-sharding-key-generate-strategy-with-generator"
value="CREATE SHARDING KEY GENERATE STRATEGY order_id_strategy (TABLE=t_order,
COLUMN=order_id, GENERATOR=snowflake_generator)" db-types="ShardingSphere" />