-
Notifications
You must be signed in to change notification settings - Fork 37
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: microsoft/SqlScriptDOM
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev/llali/fixsyncissues
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: microsoft/SqlScriptDOM
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 6 commits
- 93 files changed
- 7 contributors
Commits on Sep 29, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 9addf20 - Browse repository at this point
Copy the full SHA 9addf20View commit details
Commits on Oct 7, 2025
-
Sync Repos: Release 170.128.0 (#173)
* Merged PR 1818918: Adding for Order Clause to JSON_ARRAYAGG # 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 Adding for Order Clause to JSON_ARRAYAGG ---- #### AI description (iteration 1) #### PR Classification New feature addition to support an ORDER BY clause in JSON_ARRAYAGG. #### PR Summary This pull request adds comprehensive support for an ORDER BY clause in JSON_ARRAYAGG function calls by updating the parser grammar, AST definitions, and script generation logic, accompanied by new tests ensuring correct implementation. - In `SqlScriptDom/Parser/TSql/TSql170.g`, updated grammar rules to include an optional `OrderByClause` for JSON_ARRAYAGG. - In `SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.FunctionCall.cs`, added logic to generate the ORDER BY clause when present. - In `SqlScriptDom/Parser/TSql/Ast.xml`, appended a new member `JsonOrderByClause` to support the syntax. - Added new test scripts and baselines in `Test/SqlDom/TestScripts/JsonArrayAggOrderBy170.sql` and `Test/SqlDom/Baselines170/JsonArrayAggOrderBy170.sql` to validate the functionality. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * Merged PR 1819059: Fix parsing 'WITH ARRAY WRAPPER' in json_query function # 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 Fix parsing 'WITH ARRAY WRAPPER' in json_query function ---- #### AI description (iteration 1) #### PR Classification Bug fix addressing incorrect parsing of the JSON_QUERY function when using the WITH ARRAY WRAPPER clause. #### PR Summary This pull request corrects the token generation for the JSON_QUERY function so that the WITH ARRAY WRAPPER clause is correctly parsed inside the function's parameter list. The changes adjust the grammar, script generator, and test expectations to match the proper syntax. - `Test/SqlDom/ParserErrorsTests.cs`: Updated error tests to reflect new token positions for the WITH ARRAY WRAPPER clause. - `SqlScriptDom/Parser/TSql/TSql170.g`: Modified grammar rules to move the closing parenthesis generation after handling the WITH clause. - `SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.FunctionCall.cs`: Reordered token generation to include the WITH ARRAY WRAPPER clause within the function call parameters. - `Test/SqlDom/Baselines170/JsonFunctionTests170.sql` and `Test/SqlDom/TestScripts/JsonFunctionTests170.sql`: Updated baseline and test scripts to match the corrected function syntax. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4716932 * Merged PR 1810300: Updated syntax for EM permissions tests # Pull Request Template for ScriptDom ## Description External Model Object are not schema - scoped and only database scoped. hence, tests scripts are updated accordingly. 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 Updated syntax for EM permissions ---- #### AI description (iteration 1) #### PR Classification Syntax update for external model permissions tests. #### PR Summary This pull request revises the SQL syntax in EM permissions tests by removing explicit schema prefixes from external model names, ensuring consistent and simplified permission statements. - Changes in `Test/SqlDom/Baselines170/SecurityStatementExternalModelTests170.sql`: Removed redundant schema qualifiers (e.g., `prod.`, `dbo.`, `schema1.`, `test.`) from external model object names. - Changes in `Test/SqlDom/TestScripts/SecurityStatementExternalModelTests170.sql`: Updated SQL statements to strip schema qualifiers, standardizing external model naming across the test scripts. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * Merged PR 1818887: [JSON] ScriptDom support for json_value Returning syntax Adds support to scriptdom for RETURNING option for json_value. Specifically support for json_value('a', 'b' RETURNING <SQL Type>) Code Change - [ ] The Common checklist has been reviewed and followed - [x] Code changes are accompanied by appropriate unit tests - [x] Identified and included SMEs needed to review code changes - [x] Follow the steps here to make changes in the code Testing Follow the steps here to add new tests for your feature Test are added to respective json test file. Documentation Update relevant documentation in the wiki and the README.md file Additional Information Support by updating grammar rules, AST definitions, code generation, and tests to handle a returning clause for JSON_VALUE with typed data. - `SqlScriptDom/Parser/TSql/TSql170.g`: Revised grammar rules to replace the JSON returning clause with one that uses a DataTypeReference, added a new jsonValueReturningClause and jsonDataType rule to enforce JSON type restrictions, and integrated JSON_VALUE into the built-in function call logic. - `SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.FunctionCall.cs`: Modified the return type generation logic to work with DataTypeReference and introduced specific handling for JSON_VALUE, ensuring proper generation of the returning clause. - `SqlScriptDom/Parser/TSql/Ast.xml`: Updated the AST definition for the ReturnType member from Identifier to DataTypeReference to support the new syntax. - `Test/SqlDom`: Expanded test cases in multiple SQL test scripts to include JSON_VALUE with various returning types, validating the new syntax. * Merged PR 1823138: Add test cases for Json_contains and Json_modify # Pull Request Template for ScriptDom ## Description This PR added several test cases for Json_contains and Json_modify. These 2 Json functions don't have special syntax that needs special handling, so just added a few test cases. 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 add test cases for Json_contains and Json_modify Related work items: #4724160 * Merged PR 1824015: Adding the release notes for 170.128.0 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: - [ ] 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 - [ ] 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 - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file Please provide any additional information that might be helpful for the reviewers Adding the release notes for 170.128.0 * fixing the test --------- Co-authored-by: Urvashi Raj <[email protected]> Co-authored-by: Shiv Prashant Sood <[email protected]> Co-authored-by: Lijun Ji <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f09e0b8 - Browse repository at this point
Copy the full SHA f09e0b8View commit details
Commits on Dec 12, 2025
-
Sync repos: release 170.147.0 (#185)
* [Security] Update .NET SDK to latest patch version (8.0.415) * Merged PR 1847463: Adding support for option RESUMABLE in ALTER TABLE ADD CONSTRAINT GitHub bug: #125 RESUMABLE is valid for 160+ reference: https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#resumable---on--off Max_Duration is valid for 120+ Reference: https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#max_duration--time--minutes- This PR introduces version-gated logic to allow RESUMABLE (and MAX_DURATION) only when the SQL Server version supports it, and updates related tests and documentation to clearly guide such validation fixes. - Updated `/SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs` to replace unconditional option rejections with checks using version flags (TSql160AndAbove and TSql120AndAbove). - Added new test scripts and baselines in `/Test/SqlDom/TestScripts/AlterTableResumableTests160.sql` and `/Test/SqlDom/Baselines160/AlterTableResumableTests160.sql`, and updated `/Test/SqlDom/Only160SyntaxTests.cs` to verify version-specific error counts. - Added comprehensive documentation in new files (e.g., `/.github/VALIDATION_FIX_GUIDE.md`, `/.github/DEBUGGING_WORKFLOW.md`, and `/.github/README.md`) to assist users in handling validation issues like this. - Updated copilot and bug fixing guides (in `/.github/copilot-instructions.md` and `/.github/BUG_FIXING_GUIDE.md`) with decision trees and pract... * Merged PR 1870990: Fixing the bug JSON_OBJECT does not parse inside RETURN statement # Pull Request Template for ScriptDom ## Description Fixing bug #181 Fixing the bug JSON_OBJECT does not parse inside RETURN statement Bug fix and documentation update to ensure JSON_OBJECT (and related JSON functions) parse correctly inside RETURN statements. #### PR Summary This pull request fixes the issue where JSON_OBJECT was failing in RETURN statements by introducing token-based syntactic predicates across multiple grammar files, and it also adds supporting test cases and comprehensive documentation updates for testing and function extension in SqlScriptDOM. - `SqlScriptDom/Parser/TSql/TSql160.g`, `TSql170.g`, and `TSqlFabricDW.g`: Added new `jsonObjectCall` and `jsonArrayCall` rules with proper syntactic predicates. - `Test/SqlDom/TestScripts` and `Test/SqlDom/Baselines160`: Introduced new tests and baselines for JSON_OBJECT, JSON_ARRAY, and TRIM usage in RETURN statements. - `/.github/instructions` and `/.github/prompts`: Added detailed guidelines for testing, new system function implementation, and grammar extension patterns. - `Test/SqlDom/Only160SyntaxTests.cs` and `/.github/copilot-instructions.md`: Updated test configurations and documentation references to include the new JSON function tests. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * Merged PR 1874197: Adding prompts to help developer using github copilot # Pull Request Template for ScriptDom ## Description - Adding prompt files to run in VScode github copilot and it help developers with using the copilot to generate the code. - Adding more instructions files for new features - Fixing the test library to write enough info for copilot to know better how to fix the tests. #### PR Summary This PR adds detailed guidelines for adding new index and data types, a new feature implementation prompt to assist GitHub Copilot users, and updates testing and documentation instructions throughout the repository. - Added new guideline files: `/.github/instructions/new_index_types.guidelines.instructions.md` and `/.github/instructions/new_data_types.guidelines.instructions.md` with step‑by‑step instructions. - Introduced a new prompt file `/.github/prompts/new-feature-implementation.prompt.md` to guide feature type identification for developers. - Updated testing guidance in `/.github/instructions/testing.guidelines.instructions.md` and refactored ParserTest constructors to use nullable error counts. - Modified copilot instructions and README links to reflect renamed and relocated guidelines. - Made minor changes in test utilities and baseline test files to support these updates. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * Merged PR 1870962: Add test case for JSON_OBJECTAGG with qualified column references (GitHub issue #175) ## Issue Users reported that `JSON_OBJECTAGG` was not parsing correctly with TSql170Parser, receiving the error "Incorrect syntax near ':'". Example that was failing: ```sql SELECT JSON_OBJECTAGG( t.c1 : t.c2 ) FROM ( VALUES('key1', 'c'), ('key2', 'b'), ('key3','a') ) AS t(c1, c2); ``` ## Investigation Results After thorough analysis, I found that **the grammar for JSON_OBJECTAGG is already complete and correct** in `SqlScriptDom/Parser/TSql/TSql170.g`. All supporting code exists: - ✅ Grammar rules in TSql170.g (lines 32584, 33029-30, 33135) - ✅ `jsonKeyValueExpression` rule handles both shorthand and explicit colon syntax - ✅ `CodeGenerationSupporter.JsonObjectAgg` constant defined - ✅ `JsonKeyValue` AST class with proper properties - ✅ Script generator visitor for JsonKeyValue - ✅ Comprehensive positive tests in `JsonFunctionTests170.sql` - ✅ Comprehensive negative tests in `ParserErrorsTests.cs` ## Root Cause The issue is that the **parser needs to be regenerated** from the grammar files via the build process. The grammar has the correct implementation, but the generated parser code needs to be updated. ## Changes Made Added a test case to `JsonFunctionTests170.sql` that exactly matches the reported issue scenario: - **Test script**: Added test with qualified column names `t.c1 : t.c2` - **Baseline**: Added expected normalized output This ensures future builds will include this specific test case and the parser will handle qualified column references in JSON_OBJECTAGG correctly. ## Next Steps When the build runs, it will: 1. Regenerate the parser from TSql170.g using ANTLR 2. Compile the updated parser 3. Run all tests (which should pass) 4. Publish a new NuGet package with the working parser ## Verification The fix can be verified with: ```csharp var script = @"SELECT JSON_OBJECTAGG( t.c1 : t.c2 ) FROM ( VALUES('key1', 'c'), ('key2', 'b'), ('key3','a') ) AS t(c1, c2);"; var parser = new TSql170Parser(true); var fragment = parser.Parse(new StringReader(script), out var parseErrors); Assert.AreEqual(0, parseErrors.Count); // Should pass after build ``` Fixes: [scriptdom is missing json_objectagg](https://msdata.visualstudio.com/web/wi.aspx?pcguid=8b119ea1-2e2a-4839-8db7-8c9e8d50f6fa&id=4792111) <p><small class=\"secondary-text\">AI-generated content may be incorrect</small></p> <!-- GitOpsUserAgent=GitOps.Apps.Server.copilotswe --> Co-authored-by: Azure Pipelines Test Service <> Co-authored-by: GitHub Copilot <> Co-authored-by: Leila Lali <[email protected]> Related work items: #4792111 * Merged PR 1882663: Adding a prompt to analyze dsmain ADO commit # Pull Request Template for ScriptDom This PR introduces new automation prompts and demo instructions for ADO commit analysis and T-SQL verification, along with updates to testing guidelines and configuration adjustments. #### PR Summary The changes add detailed prompts and demonstration files to automate the analysis of ADO commits (including VECTOR_SEARCH validation and bug reporting), update testing instructions and guidelines to enforce unit test best practices, and adjust ADO configuration settings. - **`.github/prompts/analyze-ado-commit-for-tsql-verification.prompt.md`**: New prompt outlining the complete workflow for analyzing ADO commits for T-SQL verification and creating bug reports. - **`.github/demo/analyze_ado_commit_demo.md` & `.github/demo/new-feature-implementation_demo.md`**: Demo files showcasing the automated analysis process and the implementation fix for the VECTOR_SEARCH function (supporting 3-part identifiers). - **`.github/prompts/verify-and-test-tsql-syntax.prompt.md`**: Updated prompt with enhanced debugging and unit test instructions for verifying T-SQL syntax. - **Guideline Instruction Updates (`.github/instructions/*`)**: Revised testing, bug fixing, and function guidelines to mandate unit test usage and align testing procedures. - **`.vscode/mcp.json`**: Modified ADO configuration with an updated area path for proper integration. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> * remove some ADO guidlines * Merged PR 1898573: Adding Release notes for 170.147.0 Adding Release notes for 170.147.0
Configuration menu - View commit details
-
Copy full SHA for ab77781 - Browse repository at this point
Copy the full SHA ab77781View commit details
Commits on Jan 23, 2026
-
Sync repos: Release 170.157.0 (#186)
* Merged PR 1821782: Fixing the parse issue with vector type Parser would timeout or crash when parsing queries with VECTOR data types in deeply nested JOIN structures due to exponential complexity (O(2^n)) in ANTLR's syntactic predicate lookahead. The `selectTableReferenceElement` grammar rule uses recursive syntactic predicates that cause exponential backtracking when VECTOR types appear in complex join hierarchies. Each additional nesting level doubles the parsing attempts. Implemented conditional optimization using `ContainsVectorInLookahead()` helper method: - Scans ahead up to 200 tokens to detect VECTOR keyword - When VECTOR detected: applies `SaveGuessing` optimization to reduce complexity from O(2^n) to O(n²) - When no VECTOR: uses standard grammar path with minimal overhead (~1-2ms) - **TSql170.g**: Modified `selectTableReferenceElement` rule with conditional SaveGuessing - **TSql170ParserBaseInternal.cs**: Added `ContainsVectorInLookahead()` helper method - **ComplexQueryTests170.sql**: Added comprehensive test coverage (6 queries) - 5 VECTOR scenarios: CAST, CONVERT, deeply nested JOINs with VECTOR types - 1 non-VECTOR scenario: Complex 6-way nested JOIN to validate no regression - All 1,122 tests passing (0 failures) - VECTOR queries: Previously timeout/crash → now parse successfully - Non-VECTOR queries: No measurable performance impact - Cross-version validation: Appropriate error counts for TSql80-160 - **Overhead**: O(1) per table reference (200-token scan) - **Typical queries**: <2ms additional overhead - **VECTOR queries**: Massive improvement (timeout → completes) - **Verdict**: Acceptable tradeoff for critical fix Related work items: #4819213 * Merged PR 1921093: [Fabric DW] Add support for Fabric DW specific AI functions This PR adds support for Fabric DW specific AI functions: - `ai_analyze_sentiment(<input>)` - `ai_classify(<input>, <class1>, <class2>[, <class 3>, ...])` - `ai_extract(<input>, <label1>[, <label2>, ...])` - `ai_fix_grammar(<input>)` - `ai_generate_response(<promptPart1>[, <promptPart2>])` - `ai_summarize(<input>)` - `ai_translate(<input>, <lang>)` Detailed design document is here: https://microsoft.sharepoint.com/:w:/r/teams/AzurePolaris/_layouts/15/doc2.aspx?sourcedoc=%7B75BAC667-A870-4482-8A37-F80E6EC8FCE0%7D&file=AI%20and%20Extensibiliy.docx Before submitting your pull request, please ensure you have completed the following: - [x] 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 - [x] Code changes are accompanied by appropriate unit tests - [x] Identified and included SMEs needed to review code changes - [X] 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 - [x] 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 - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ---- New feature: Adding support for Fabric DW–specific AI built-in functions. This pull request extends the SQL parser for Fabric DW by introducing new AI functions and their corresponding AST representations, script generators, and tests. Key changes include: - **`TSqlFabricDW.g`**: Added grammar rules for AI functions (e.g., AI_ANALYZE_SENTIMENT, AI_CLASSIFY, AI_EXTRACT, AI_GENERATE_RESPONSE, AI_SUMMARIZE, AI_TRANSLATE). - **`Ast.xml`**: Introduced new AST classes to represent the AI function calls. - **Script Generator Files**: Created new files in `SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/` to define visitors for the AI functions. - **`CodeGenerationSupporter.cs`**: Added new constants to support the AI function tokens. - **Test Files**: Included multiple test scripts and negative tests under `/Test/SqlDom/` to validate the syntax and error handling for the newly added functions. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4924682 * Merged PR 1921976: Fixing IIF parsing when it occurs inside a parenthesis. # Pull Request Template for ScriptDom ## Description Fixes: #28 The TSql160Parser.ParseExpression() was failing to parse valid T-SQL expressions where IIF with boolean operators was wrapped in parentheses: ```sql SELECT 1 WHERE (IIF(1 > 0 AND 2 > 1, 1, 0)) = 1 ``` Customers reported this issue when using IIF expressions with multiple boolean operators (AND, OR, >, <, etc.) wrapped in parentheses. The original code used a simple counter (insideIIf) to track when inside an IIF call. The counter was decremented on the first boolean operator inside the IIF (e.g., >). When a second operator like AND was encountered, insideIIf was already 0, causing it to be misidentified as a top-level boolean operator - which incorrectly signaled that the outer parentheses contained a boolean expression instead of a scalar expression. Replaced the simple counter with stack-based parenthesis depth tracking. This properly tracks when we're inside an IIF by remembering the parenthesis depth where each IIF started, rather than incorrectly decrementing on boolean operators. This also correctly handles: Nested IIF expressions: `(IIF(IIF(a > 1, b, c) > 2, 1, 0))` Deeply nested parentheses: `((((IIF(1 > 0 AND 2 > 1, 1, 0)))) = 1` Multiple IIF expressions: `(IIF(...)) = 1 AND (IIF(...)) = 1` ## 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 ---- #### AI description (iteration 1) #### PR Classification Bug fix to correct the parsing of IIF expressions when they occur inside parentheses. #### PR Summary This pull request fixes the incorrect handling of nested IIF expressions by replacing a simple counter with a stack-based approach and a pending flag, ensuring accurate tracking of IIF parentheses. The update enhances the SQL parser and adds regression tests to validate various scenarios. - `SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs`: Refactor... * Merged PR 1932484: Adding release notes for 170.157.0 # Pull Request Template for ScriptDom ## Description Adding release notes for 170.157.0 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 Adding release notes for 170.157.0 ---- #### AI description (iteration 1) #### PR Classification Documentation update providing the release notes for version 170.157.0. #### PR Summary This pull request adds a new release notes file for Microsoft.SqlServer.TransactSql.ScriptDom 170.157.0, detailing supported platforms, dependency updates, new AI function support, and fixes for specific issues. - `release-notes/170/170.157.0.md`: New file containing the release information including target platform support, updated .NET SDK dependency (8.0.415), addition of Fabric DW-specific AI functions, and fixes for issues #161 and #28. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> --------- Co-authored-by: Maksim Vlasov <[email protected]> Co-authored-by: Aasim Khan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c152271 - Browse repository at this point
Copy the full SHA c152271View commit details
Commits on Feb 4, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 5ddf970 - Browse repository at this point
Copy the full SHA 5ddf970View commit details
Commits on Feb 13, 2026
-
Sync Repos: Release 170.168.0 (#190)
* Merged PR 1952906: JSON_ARRAYAGG support for OVER clause # Pull Request Template for ScriptDom ## Description `JSON_ARRAYAGG` supports windowed aggregate usage via the `OVER (PARTITION BY ...)` clause in SQL Server, but ScriptDOM was missing support for parsing and generating it. This PR adds OVER clause support for `JSON_ARRAYAGG` in the TSql170 parser and script generator. **SQL syntax now supported:** ```sql SELECT JSON_ARRAYAGG(name) OVER (PARTITION BY dept) FROM employees; SELECT JSON_ARRAYAGG(name ABSENT ON NULL) OVER (PARTITION BY dept) FROM employees; SELECT JSON_ARRAYAGG(name NULL ON NULL) OVER (PARTITION BY dept) FROM employees; SELECT JSON_ARRAYAGG(name ORDER BY name NULL ON NULL RETURNING JSON) OVER (PARTITION BY dept) FROM employees; ``` * Merged PR 1948594: Fix allocation issue in TSql80ParserBaseInternal.AddAndUpdateTokenInfo High memory allocations were detected in the `TSql80ParserBaseInternal.AddAndUpdateTokenInfo` method, specifically in the overload that processes collections. The method uses a `foreach` loop to iterate over an `IList<TFragmentType>` collection, which causes the allocation of a boxed `List.Enumerator` object on every invocation. Since this is a hot path in the SQL parser (called frequently during parsing operations), these repeated allocations contribute significantly to GC pressure. Performance impact: This issue appears in 0.28% of high allocation traces and allocates 3.0 MB/sec at both the 50th and 90th percentiles. ## Solution Replaced the `foreach` loop with an index-based `for` loop in the `AddAndUpdateTokenInfo` method. The new implementation iterates using an integer index from 0 to `otherCollection.Count`, accessing each element via the indexer. This eliminates the enumerator allocation while preserving identical functionality and behavior. The change is made in `/SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs` at lines 292-299. **Before:** ```csharp foreach (TFragmentType item in otherCollection) { AddAndUpdateTokenInfo(node, collection, item); } ``` **After:** ```csharp for (int i = 0; i < otherCollection.Count; i++) { TFragmentType item = otherCollection[i]; AddAndUpdateTokenInfo(node, collection, item); } ``` ## Benefits - Eliminates boxing allocation of `List.Enumerator` on hot path - Reduces GC pressure and improves parser performance - Maintains identical behavior and semantics - Minimal code change with no API modifications * Merged PR 1881483: Add support for 3-part and 4-part identifiers in VECTOR_SEARCH TOP_N parameter <!-- COPILOT_AI_GENERATED_START --> ## Summary This PR enables the VECTOR_SEARCH table-valued function to accept 3-part and 4-part column identifiers in the TOP_N parameter, allowing queries like: ```sql SELECT qt.qid, src.id, ann.distance FROM QueryTable qt CROSS APPLY VECTOR_SEARCH( TABLE = graphnode AS src, COLUMN = embedding, SIMILAR_TO = qt.qembedding, METRIC = 'euclidean', TOP_N = dbo.qt.top_n -- 3-part identifier now supported ) AS ann ``` Previously, the parser only accepted up to 2-part identifiers (e.g., `qt.top_n`) in the TOP_N parameter, which prevented queries using schema-qualified column references in CROSS APPLY scenarios. ## Changes Made ### Grammar Rule Update Modified the `vectorSearchColumnReferenceExpression` rule in `SqlScriptDom/Parser/TSql/TSql170.g` to allow up to 4-part identifiers instead of the previous 2-part limit. This change enables the TOP_N parameter to accept: - Simple identifiers: `@variable` or `columnName` - 2-part identifiers: `table.column` - 3-part identifiers: `schema.table.column` (the primary use case from the issue) - 4-part identifiers: `database.schema.table.column` The change was minimal—updating a single parameter from `multiPartIdentifier[2]` to `multiPartIdentifier[4]` in line 33971 of TSql170.g. This aligns with standard SQL Server column reference behavior in other contexts. ### Test Coverage Added comprehensive test coverage in `Test/SqlDom/TestScripts/VectorSearchCrossApplyTests170.sql` with a test case that validates the exact query pattern from the issue. The test includes: - A DECLARE statement setting up a VECTOR variable - A SELECT query with CROSS APPLY using VECTOR_SEARCH - The TOP_N parameter specified as a 3-part identifier (`dbo.qt.top_n`) The corresponding baseline file `Test/SqlDom/Baselines170/VectorSearchCrossApplyTests170.sql` captures the expected formatted output from the parser. Updated `Test/SqlDom/Only170SyntaxTests.cs` to register the new test case with appropriate error counts for older parser versions (TSql80 through TSql160), which still use the 2-part identifier limit and correctly report parse errors for this syntax. ## Impact This change only affects the TSql170 (SQL Server 2025) parser and is backward compatible. The AST definition already used `ScalarExpression` for the TopN member, so no AST changes were required. Older parser versions continue to enforce the 2-part identifier limit and generate expected parse errors for 3-part identifiers. The fix enables real-world scenarios where VECTOR_SEARCH is used in CROSS APPLY with outer references that require schema qualification, which is common in production databases with explicit schema naming conventions. Fixes: #4843961 * Merged PR 1881565: ## Fix VECTOR_SEARCH SIMILAR_TO Parameter to Reject Subqueries <!-- COPILOT_AI_GENERATED_START --> ### Summary The VECTOR_SEARCH function in the TSql170 parser was incorrectly allowing subqueries in the SIMILAR_TO parameter. This fix adds validation to properly reject subqueries and throw an appropriate parse error, aligning with SQL Server 2025 implementation requirements. ### Problem The SIMILAR_TO parameter was accepting any scalar expression, including subqueries wrapped in parentheses. This allowed invalid syntax like: ```sql SELECT * FROM VECTOR_SEARCH( TABLE = graphnode, COLUMN = embedding, SIMILAR_TO = (SELECT TOP 1 embedding FROM GTQuery), -- Should error but didn't METRIC = 'euclidean', TOP_N = 20 ) AS ann ``` This syntax should be rejected because subqueries are not supported in the SIMILAR_TO parameter, similar to how they are restricted in other contexts. ### Solution Added validation logic in the `vectorSearchTableReference` grammar rule (`SqlScriptDom/Parser/TSql/TSql170.g`) that checks if the SIMILAR_TO expression is a `ScalarSubquery` type. When detected, the parser now throws a SQL46098 error with the message "Subqueries are not allowed in this context. Only scalar expressions are allowed." The validation follows the same pattern used elsewhere in the grammar for similar restrictions and is placed immediately after matching the SIMILAR_TO identifier, before assigning the expression to the result object. ### Testing Added a comprehensive error test case in `Test/SqlDom/ParserErrorsTests.cs` within the existing `VectorSearchErrorTest170` method. The test verifies that: - Subqueries in the SIMILAR_TO parameter are properly rejected - The correct error code (SQL46098) is generated - The error position is accurately reported Valid syntax continues to work correctly, including: - Variables: `SIMILAR_TO = @qv` - Column references: `SIMILAR_TO = outerref.vector_col` - Other scalar expressions that are not subqueries ### Impact - **All 558 existing tests pass** with no regressions - **Minimal change**: Only 12 lines added across 2 files - **Consistent behavior**: Uses the same error code and message pattern as other subquery restrictions in the parser - **Backward compatible**: Only rejects previously invalid syntax that should not have been allowed Fixes: #4844065 Related work items: #4844065 * Merged PR 1959169: Adding release notes for 170.168.0 # 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 Adding release notes for 170.168.0 --------- Co-authored-by: Shiv Prashant Sood <[email protected]> Co-authored-by: GitHub Copilot <GitHub Copilot>Configuration menu - View commit details
-
Copy full SHA for c6e10b2 - Browse repository at this point
Copy the full SHA c6e10b2View commit details
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff dev/llali/fixsyncissues...main