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 d1e6ad19bbb Support for the QUERYTRACEON query hint (#36686)
d1e6ad19bbb is described below
commit d1e6ad19bbb5144a121ce783596eee4252cc9371
Author: cxy <[email protected]>
AuthorDate: Thu Sep 25 15:22:29 2025 +0800
Support for the QUERYTRACEON query hint (#36686)
---
.../sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4 | 2 +-
test/it/parser/src/main/resources/case/dml/select.xml | 9 +++++++++
test/it/parser/src/main/resources/sql/supported/dml/select.xml | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git
a/parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
b/parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
index 8d5c79130d7..314eb8c9548 100644
---
a/parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
+++
b/parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
@@ -345,7 +345,7 @@ queryHint
| OPTIMIZE FOR LP_ optimizeForParameter (COMMA_ optimizeForParameter)* RP_
| OPTIMIZE FOR UNKNOWN
| PARAMETERIZATION (SIMPLE | FORCED)
- | QUERYTRACEON INT_NUM_
+ | QUERYTRACEON NUMBER_ (COMMA_ QUERYTRACEON NUMBER_)*
| RECOMPILE
| ROBUST PLAN
| USE HINT LP_ useHitName (COMMA_ useHitName)* RP_
diff --git a/test/it/parser/src/main/resources/case/dml/select.xml
b/test/it/parser/src/main/resources/case/dml/select.xml
index 83b5b6ef234..1b64af1c953 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -11778,4 +11778,13 @@
<simple-table name="Person" start-index="14" stop-index="19" />
</from>
</select>
+
+ <select sql-case-id="select_querytraceon_hint">
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <from>
+ <simple-table name="Person" start-index="14" stop-index="19" />
+ </from>
+ </select>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
index 4c09f62fa8a..4f7228dcfcf 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
@@ -376,4 +376,5 @@
<sql-case id="select_maxdop_hint" value="SELECT * FROM Person OPTION
(MAXDOP 2);" db-types="SQLServer"/>
<sql-case id="select_for_timestamp_as_of_hint" value="SELECT * FROM Person
OPTION (FOR TIMESTAMP AS OF '2024-03-13T19:39:35.28');" db-types="SQLServer"/>
<sql-case id="select_force_single_node_plan_hint" value="SELECT * FROM
Person OPTION (FORCE SINGLE NODE PLAN);" db-types="SQLServer"/>
+ <sql-case id="select_querytraceon_hint" value="SELECT * FROM Person OPTION
(QUERYTRACEON 4199, QUERYTRACEON 4137);" db-types="SQLServer"/>
</sql-cases>