-
Notifications
You must be signed in to change notification settings - Fork 24
Sync repos: Release170.53.0 #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request introduces a new feature to support table cloning via the "CREATE TABLE AS CLONE" syntax only for Fabric DW. CREATE TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name } AS CLONE OF { database_name.schema_name.table_name | schema_name.table_name | table_name } [AT {point_in_time}] [CREATE TABLE AS CLONE OF - SQL Server | Microsoft Learn](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-as-clone-of-transact-sql?view=fabric&preserve-view=true#syntax) #### PR Summary The changes implement cloning functionality by extending both the SQL script generator and parser to handle the new clone syntax with an optional point-in-time clause. - `SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CreateTableStatement.cs`: Added code to generate the `AS CLONE OF` syntax with an optional `AT` clause and bypass standard logic if clone details are provided. - `SqlScriptDom/Parser/TSql/TSqlFabricDW.g` and `SqlScriptDom/Parser/TSql/Ast.xml`: Updated the grammar and AST definitions to include new members (`CloneSource` and `ClonePointInTime`) for clone statements. - Test suite modifications: Added new test files (`CloneTableTestsFabricDW.sql`) for the clone syntax and removed obsolete scalar function test files. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4200381
This pull request modifies the Scalar Function feature only for Fabric DW, while keeping the existing implementation for Table Value Functions unchanged. This is the exact syntax we are looking to support for Fabric SQL: ``` CREATE [ OR ALTER ] FUNCTION [ schema_name. ] function_name ( [ { @parameter_name [ AS ] parameter_data_type [ = default ] } [ ,...n ] ] ) RETURNS return_data_type [ WITH <function_option> [ ,...n ] ] [ AS ] BEGIN function_body RETURN scalar_expression END [ ; ] <function_option> ::= { [ SCHEMABINDING ] | [ RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT ] | [EXECUTE AS] } ``` Hence the changes made to the TSqlFabricDW.g grammar file in this PR aim to achieve the following code diff in supported TSQL Syntax for Fabric:  [Task 1639617](https://dev.azure.com/powerbi/AI/_workitems/edit/1639617): ScriptDom - Table & Scalar valued functions support ---- #### AI description (iteration 1) #### PR Classification This pull request implements new scalar function support by updating the TSqlFabricDW parser grammar and associated tests. #### PR Summary The changes add new grammar productions for scalar function parameters and attributes, update function productions to use these new definitions, and introduce new positive and negative test scripts while removing outdated Int/VarChar tests. - Updated `/SqlScriptDom/Parser/TSql/TSqlFabricDW.g` to add new productions for scalar function parameters, attributes, and options. - Modified existing productions (`functionParameter` and `functionReturnTypeAndBody`) to integrate the new scalar function definitions. - Added new test scripts in `/Test/SqlDom/BaselinesFabricDW/` and `/Test/SqlDom/TestScripts/` for scalar function positive and negative cases. - Adjusted `/Test/SqlDom/OnlyFabricDWSyntaxTests.cs` to include the new positive test while removing references to deprecated test files. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4219784
…ABLE - TSqlFabricDW This pull request introduces a new table option for clustering columns during CREATE TABLE and ALTER TABLE statements only for Fabric DW. This is the specific syntax we aim to support: ``` CREATE TABLE {database_name.schema_name.table_name | schema_name.table_name | table_name } ( { column_name <data_type> } [ ,…n] ) WITH (CLUSTER BY (column_name, [ ,…n])) ALTER TABLE {database_name.schema_name.table_name | schema_name.table_name | table_name } ADD (CLUSTER BY (column_name, [ ,…n])) ``` [Task 1639622](https://dev.azure.com/powerbi/AI/_workitems/edit/1639622/): ScriptDom - Create Table with Data Clustering support This PR also adds a test to verify that the Create External Table statement is supported in our new TSqlFabricDW parser with the following format: ``` CREATE EXTERNAL TABLE <SchemaName].<ExternalTableName> ( <column_definition> [ ,...n ] ) WITH ( LOCATION = '<Path>', FILE_FORMAT = <FileFormatName> ); ``` [Task 1639619](https://dev.azure.com/powerbi/AI/_workitems/edit/1639619/): ScriptDom - Create External Tables support ---- #### AI description (iteration 1) #### PR Classification This pull request implements a new feature by adding support for the CLUSTER BY clause in CREATE and ALTER TABLE statements for Fabric DW. #### PR Summary The changes extend the SQL parser, AST, and script generator to handle the new CLUSTER BY option and include tests to validate the syntax. - **`/SqlScriptDom/ScriptDom/SqlServer`**: Added generator implementations (`SqlScriptGeneratorVisitor.AlterTableAddClusterByStatement.cs` and `SqlScriptGeneratorVisitor.ClusterByTableOption.cs`) to output the CLUSTER BY clause. - **`/SqlScriptDom/Parser/TSql` & `/SqlScriptDom/Parser/TSql/Ast.xml`**: Updated grammar rules and AST definitions to recognize and parse the new CLUSTER BY syntax, including a new alter table statement alternative. - **`/Test/SqlDom`**: Introduced new test scripts and baselines (along with an update in `OnlyFabricDWSyntaxTests.cs`) to verify the functionality for both table creation and alteration using the CLUSTER BY clause. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4235116
# Pull Request Template for ScriptDom ## Description Please provide a detailed description, include the link to the design specification or SQL feature document for the new TSQL syntaxes. Make sure to add links to the Github or DevDiv issue Before submitting your pull request, please ensure you have completed the following: ## Code Change - [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [ ] Code changes are accompanied by appropriate unit tests - [ ] Identified and included SMEs needed to review code changes - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information Please provide any additional information that might be helpful for the reviewers
zijchen
approved these changes
Jun 6, 2025
* Update TestUtilities.cs Signed-off-by: Zi Chen <[email protected]> * Use IndexOf instead of hardcoded values --------- Signed-off-by: Zi Chen <[email protected]>
dzsquared
approved these changes
Jun 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Please provide a detailed description. Be as descriptive as possible - include information about what is being changed,
why it's being changed, and any links to relevant issues. If this is closing an existing issue use one of the issue linking keywords to link the issue to this PR and have it automatically close when completed.
In addition, go through the checklist below and check each item as you validate it is either handled or not applicable to this change.
Code Changes