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 6f5898cbb9e Support for the MAXDOP query hint (#36516)
6f5898cbb9e is described below

commit 6f5898cbb9ebfb6be82dffc632e71974ce1fad79
Author: cxy <[email protected]>
AuthorDate: Wed Sep 10 17:15:47 2025 +0800

    Support for the MAXDOP query hint (#36516)
---
 .../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 2be1723e129..2a238c41c64 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
@@ -339,7 +339,7 @@ queryHint
     | KEEPFIXED PLAN
     | MAX_GRANT_PERCENT EQ_ DECIMAL_NUM_
     | MIN_GRANT_PERCENT EQ_ DECIMAL_NUM_
-    | MAXDOP INT_NUM_
+    | MAXDOP NUMBER_
     | MAXRECURSION NUMBER_
     | NO_PERFORMANCE_SPOOL
     | OPTIMIZE FOR LP_ optimizeForParameter (COMMA_ optimizeForParameter)* 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 d8fa4ddaa35..b302a92b610 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -11751,4 +11751,13 @@
             <simple-table name="Person" start-index="14" stop-index="19" />
         </from>
     </select>
+
+    <select sql-case-id="select_maxdop_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 0aff6116e47..575b3ad5f55 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
@@ -373,4 +373,5 @@
     <sql-case id="select_optimize_for_hint" value="SELECT * FROM Person OPTION 
( OPTIMIZE FOR (@city_name = 'Seattle', @postal_code UNKNOWN) );" 
db-types="SQLServer"/>
     <sql-case id="select_fast_hint" value="SELECT * FROM Person OPTION (HASH 
GROUP, FAST 10);" db-types="SQLServer"/>
     <sql-case id="select_use_hint" value="SELECT * FROM Person OPTION 
(RECOMPILE, USE HINT ('ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES', 
'DISABLE_PARAMETER_SNIFFING'));" db-types="SQLServer"/>
+    <sql-case id="select_maxdop_hint" value="SELECT * FROM Person OPTION 
(MAXDOP 2);" db-types="SQLServer"/>
 </sql-cases>

Reply via email to