TherChenYang opened a new pull request, #29655:
URL: https://github.com/apache/shardingsphere/pull/29655
Fixes #29158.
Changes proposed in this pull request:
- Add support for parse update statistics [official website
link](https://learn.microsoft.com/zh-cn/sql/t-sql/statements/update-statistics-transact-sql?view=sql-server-ver16)
- Add update statistics statement
- Add update statistics assert

---
Support for the following update statistics sql
**update_statistics_with_no_index**
```sql
UPDATE STATISTICS Sales.SalesOrderDetail;
```
**update_statistics_with_full_scan**
```sql
UPDATE STATISTICS Customer (CustomerStats1) WITH FULLSCAN;
```
**update_statistics_with_auto_drop**
```sql
UPDATE STATISTICS Customer (CustomerStats1) WITH AUTO_DROP = ON;
```
**update_statistics_with_sample**
```sql
UPDATE STATISTICS Production.Product(Products) WITH SAMPLE 50 PERCENT;
```
**update_statistics_with_full_scan_no_recompute**
```sql
UPDATE STATISTICS Production.Product(Products) WITH FULLSCAN, NORECOMPUTE;
```
**update_statistics_with_resample_on_partitions**
```sql
UPDATE STATISTICS dbo.PartitionIncrStatDemo(IX_PartitionIncrStatDemo_ID)
WITH RESAMPLE ON PARTITIONS(3)
```
---
Support for the following sql in #29158
```sql
SELECT -- Find an event you want.
p.name AS [Package-Name],
o.object_type,
o.name AS [Object-Name],
o.description AS [Object-Descr],
p.guid AS [Package-Guid]
FROM sys.dm_xe_packages AS p
INNER JOIN sys.dm_xe_objects AS o
ON p.guid = o.package_guid
WHERE o.object_type = 'event' --'action' --'target'
AND p.name LIKE '%'
AND o.name LIKE '%sql%'
ORDER BY p.name,
o.object_type,
o.name
```
```sql
SELECT ProductId, Name, value
FROM Product
CROSS APPLY STRING_SPLIT(Tags, ',')
```
```sql
SELECT value as tag, COUNT(*) AS [number_of_articles]
FROM Product
CROSS APPLY STRING_SPLIT(Tags, ',')
GROUP BY value
HAVING COUNT(*) > 2
ORDER BY COUNT(*) DESC
```
---
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]