TherChenYang opened a new pull request, #29721:
URL: https://github.com/apache/shardingsphere/pull/29721

   Fixes #29153 .
   
   Changes proposed in this pull request:
     - Support parsing SQL Server open json function [Official website grammar 
definition](https://learn.microsoft.com/zh-cn/sql/t-sql/functions/openjson-transact-sql?view=sql-server-ver16)
   <img width="738" alt="image" 
src="https://github.com/apache/shardingsphere/assets/124348939/6a3a8b17-c97a-40ea-acbe-9d523b1133f7";>
     - Fixed the problem with parsing errors in projection compound expressions
       > examle
   
![image](https://github.com/apache/shardingsphere/assets/124348939/fe7dba7d-0f47-4542-8006-beed184c5c81)
   
![image](https://github.com/apache/shardingsphere/assets/124348939/180cd927-ff64-4ad7-84c7-46cd0f9e258a)
     - Support for sql parsing in issule #29153 
   
   ```sql
   INSERT @table1 (c2, is_transient) VALUES (N'sample durable', 0)
   ```
   
   ```sql
   SELECT product_id   
   FROM products   
   WHERE CONTAINS(product_description, '"Snap Happy 100EZ" OR 
FORMSOF(THESAURUS,"Snap Happy") OR "100EZ"')
   AND product_cost < 200
   ```
   
   ```sql
   SELECT * FROM OPENJSON(@array)
           WITH (  month VARCHAR(3),
                   temp int,
                   month_id tinyint '$.sql:identity()') as months
   ```
   
   ```sql
   SELECT [key], value
   FROM OPENJSON(@json,'$.path.to."sub-object"')
   ```
   
   ```sql
   SELECT reason, score,
         script = JSON_VALUE(details, '$.implementationDetails.script'),
         planForceDetails.*,
         estimated_gain = (regressedPlanExecutionCount + 
recommendedPlanExecutionCount)
                     * (regressedPlanCpuTimeAverage - 
recommendedPlanCpuTimeAverage)/1000000,
         error_prone = IIF(regressedPlanErrorCount > recommendedPlanErrorCount, 
'YES','NO')
   FROM sys.dm_db_tuning_recommendations
   CROSS APPLY OPENJSON (Details, '$.planForceDetails')
       WITH (  [query_id] int '$.queryId',
               regressedPlanId int '$.regressedPlanId',
               recommendedPlanId int '$.recommendedPlanId',
               regressedPlanErrorCount int,
               recommendedPlanErrorCount int,
               regressedPlanExecutionCount int,
               regressedPlanCpuTimeAverage float,
               recommendedPlanExecutionCount int,
               recommendedPlanCpuTimeAverage float
             ) AS planForceDetails
   ```
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C 
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to