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 906de9b343f fix:Support for the LANGUAGE identifier (#36110)
906de9b343f is described below

commit 906de9b343f4023356a76b0f8b102624b2a4f554
Author: cxy <xiaosaxiao...@qq.com>
AuthorDate: Wed Jul 30 09:04:41 2025 +0800

    fix:Support for the LANGUAGE identifier (#36110)
---
 .../src/main/antlr4/imports/sqlserver/BaseRule.g4  |  2 +-
 .../parser/src/main/resources/case/dml/select.xml  | 25 ++++++++++++++++++++++
 .../main/resources/sql/supported/dml/select.xml    |  1 +
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git 
a/parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 
b/parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
index aefc76943c2..48e89482c84 100644
--- a/parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
+++ b/parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
@@ -121,7 +121,7 @@ unreservedWord
     | ELASTIC_POOL | SERVICE_OBJECTIVE | DATABASE_NAME | ALLOW_CONNECTIONS | 
GEO | NAMED | DATEFIRST | BACKUP_STORAGE_REDUNDANCY | 
FORCE_FAILOVER_ALLOW_DATA_LOSS | SECONDARY | FAILOVER | 
DEFAULT_FULLTEXT_LANGUAGE
     | DEFAULT_LANGUAGE | INLINE | NESTED_TRIGGERS | TRANSFORM_NOISE_WORDS | 
TWO_DIGIT_YEAR_CUTOFF | PERSISTENT_LOG_BUFFER | DIRECTORY_NAME | DATEFORMAT | 
DELAYED_DURABILITY | TRANSFER | SCHEMA | PASSWORD | AUTHORIZATION
     | MEMBER | SEARCH | TEXT | SECOND | PRECISION | VIEWS | PROVIDER | COLUMNS 
| SUBSTRING | RETURNS | SIZE | CONTAINS | MONTH | INPUT | YEAR
-    | TIMESTAMP | TRIM | USER | RIGHT | JSON | SID | OPENQUERY | ACTION | 
TARGET | HOUR | MINUTE | TABLE | NODES | VALUE | EXIST | CHANGETABLE | VERSION 
| CHANGES | MODEL | AI_GENERATE_EMBEDDINGS | PARAMETERS | USE | FREETEXTTABLE | 
NCHAR | LEFT | RANK | ROLLUP | PIVOT | UNPIVOT | PARSE | TRY_PARSE | 
HIERARCHYID | PATINDEX | POSITION | FORCESEEK | FORCESCAN | NOEXPAND | 
SPATIAL_WINDOW_MAX_CELLS
+    | TIMESTAMP | TRIM | USER | RIGHT | JSON | SID | OPENQUERY | ACTION | 
TARGET | HOUR | MINUTE | TABLE | NODES | VALUE | EXIST | CHANGETABLE | VERSION 
| CHANGES | MODEL | AI_GENERATE_EMBEDDINGS | PARAMETERS | USE | FREETEXTTABLE | 
NCHAR | LEFT | RANK | ROLLUP | PIVOT | UNPIVOT | PARSE | TRY_PARSE | 
HIERARCHYID | PATINDEX | POSITION | FORCESEEK | FORCESCAN | NOEXPAND | 
SPATIAL_WINDOW_MAX_CELLS | LANGUAGE
     ;
 
 databaseName
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 c33d7e68206..905dcfe48c9 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -11256,4 +11256,29 @@
             </simple-table>
         </from>
     </select>
+
+    <select sql-case-id="select_language_identifier">
+        <from>
+            <simple-table name="dm_external_script_execution_stats" 
start-index="40" stop-index="77">
+                <owner name="sys" start-index="40" stop-index="42"/>
+            </simple-table>
+        </from>
+        <projections start-index="7" stop-index="33">
+            <column-projection name="counter_name" start-index="7" 
stop-index="18"/>
+            <column-projection name="counter_value" start-index="21" 
stop-index="33"/>
+        </projections>
+        <where start-index="79" stop-index="103">
+            <expr>
+                <binary-operation-expression text="language = 'Python'" 
start-index="85" stop-index="103">
+                    <left>
+                        <column name="language" start-index="85" 
stop-index="92"/>
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <literal-expression value="Python" start-index="96" 
stop-index="103"/>
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </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 c90db0df210..0aa1f229ecb 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
@@ -353,4 +353,5 @@
     <sql-case id="select_merge_join_hint" value="SELECT poh.PurchaseOrderID 
FROM Purchasing.PurchaseOrderHeader AS poh INNER MERGE JOIN 
Purchasing.PurchaseOrderDetail AS pod ON poh.PurchaseOrderID = 
pod.PurchaseOrderID;" db-types="SQLServer"/>
     <sql-case id="select_aggregation_function_over_clause" value="SELECT Name 
, MIN(Rate) OVER (PARTITION BY edh.DepartmentID) FROM 
HumanResources.EmployeePayHistory" db-types="SQLServer" />
     <sql-case id="select_on_clause" value="SELECT * INTO 
[dbo].[FactResellerSalesXL] ON FG2 FROM [dbo].[FactResellerSales];" 
db-types="SQLServer"/>
+    <sql-case id="select_language_identifier" value="SELECT counter_name, 
counter_value FROM sys.dm_external_script_execution_stats WHERE language = 
'Python';" db-types="SQLServer"/>
 </sql-cases>

Reply via email to