-
Notifications
You must be signed in to change notification settings - Fork 34
Sync repos: Release 170.121.2 #168
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
# Pull Request Template for ScriptDom ## Description Remove unused local variable from _alterDbModifyAzureOptions_ grammar rule and ensure accurate token position tracking for WITH MANUAL_CUTOVER clause. Details: • Eliminated redundant _hasManualCutover_ variable. • Improved maintainability and clarity. • Ensured UpdateTokenInfo is called for position tracking. ## Code Change - [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 ## Testing - [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 Re-ran all existing tests to ensure the code changes are not impacting anything. All tests are passing successfully:  ## 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 N/A. ---- #### AI description (iteration 1) #### PR Classification This pull request is a code cleanup that removes an unused variable and refactors manual cutover token handling in the TSql170 Antlr grammar file. #### PR Summary The changes remove the unused boolean variable in `SqlScriptDom/Parser/TSql/TSql170.g` and replace its assignment with a call to `UpdateTokenInfo` when processing the manual cutover identifier. - `SqlScriptDom/Parser/TSql/TSql170.g`: Removed the unnecessary declaration and assignment of the variable and added `UpdateTokenInfo` to update token information for manual cutover. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4005325
# Pull Request Template for ScriptDom ## Description #### AI description (iteration 1) #### PR Classification Code cleanup: Removing an unused parameter from external model parser definitions. #### PR Summary This PR streamlines the T-SQL grammar by removing the unused parameter "encounteredOptions" from external model statement rules. - `SqlScriptDom/Parser/TSql/TSql170.g`: Removed `long encounteredOptions = 0;` from the `createExternalModelStatement` rule. - `SqlScriptDom/Parser/TSql/TSql170.g`: Removed `long encounteredOptions = 0;` from the `alterExternalModelStatement` rule.
Resending PR !1780528 which was reverted to unblock release 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 Reverting commit cd69b7806dfbd6a581dbe50779a07ac70047cee8 to unblock release 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 Revert cd69b7806dfbd6a581dbe50779a07ac70047cee8 ---- This PR temporarily reverts a previous commit to remove vector data type support. The pull request reverses vector-related changes by deleting files and code modification...
As a result of the new [Optimized Locking](https://learn.microsoft.com/en-us/sql/relational-databases/performance/optimized-locking?view=sql-server-ver17) feature, new DDL has been added: `ALTER DATABASE MyDb SET OPTIMIZED_LOCKING = ON/OFF`. This PR adds this DDL to the grammar. - [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 - [X] 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 ---- This pull request introduces a new feature by adding support for the Optimized Locking database option. The pull request implements the support for the Optimized Locking option in ALTER DATABASE statements by extending both the parser and code generation components. - `SqlScriptGeneratorVisitor.OptimizedLockingAlterDatabaseOption.cs`: Implements the visitor method to generate script text for the new option based on its state (ON/OFF). - `TSql170.g` and `TSqlFabricDW.g`: Add new grammar rules to parse the Optimized Locking option and integrate it into the database option parsing logic. - `Ast.xml`: Introduces a new AST class for the Optimized Locking database option. - `DatabaseOptionKind.cs` and `CodeGenerationSupporter.cs`: Update the enumeration and constant definitions to include the Optimized Locking option. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
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 Updating .md files ---- Documentation update. This pull request revises and expands the project’s documentation to clarify developer workflows and update build instructions for SqlScriptDOM. - `/github/copilot-instructions.md` now features detailed sections on key points, build/test workflows, and common pitfalls. - A new file, `/github/BUG_FIXING_GUIDE.md`, has been added to provide a step-by-step guide for bug fixing in SqlScriptDOM. - `/README.md` and `/CONTRIBUTING.md` have been updated to use repository-relative paths and improve instructions for modifying the DOM, parser, and script generator. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…heses
This PR fixes a bug for AI_GENERATE_EMBEDDINGS when PARAMETERS comes without parentheses
"SELECT AI_GENERATE_EMBEDDINGS(large_text USE MODEL MyAzureOpenAIModel PARAMETERS '{"dimensions" : 768 }')"
Current behavior only allows PARAMETERS with parentheses. This PR adds syntax change along with tests.
- [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
Please provide any additional information that might be helpful for the reviewers
First commit
----
Bug fix to correctly handle the ScriptDom PARAMETERS clause without parentheses.
This pull request fixes the handling of the PARAMETERS clause in the AI_GENERATE_EMBEDDINGS function by conditionally emitting parentheses only when needed.
- `SqlScriptGeneratorVisitor.AiGenerateEmbeddingsFunction.cs`: Modified the code to check if OptionalParameters is a StringLiteral and, if so, emit it without surrounding parentheses.
- `TSql170.g`: Updated the grammar rules for aiGenerateEmbeddingsFunctionCall to accept either a parenthesized expression or a direct string literal.
- Test files: Adjusted baseline and test scripts, including error expectations, to validate the new syntax support.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Related work items: #4692491
# 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
This PR updates the `aiGenerateEmbeddingsFunctionCall` grammar and the script generator to:
- **Constrain model names** after `USE MODEL` to a **single token** (either an `Identifier` or one `QuotedIdentifier` like `[dbo.MyDefaultModel]`).
Multi-part names (e.g., `dbo.MyDefaultModel`, `[dbo].[MyDefaultModel]`, `MyDb.dbo.Model`) now **fail at parse time**.
- **Refine `PARAMETERS`** parsing to accept an **expression** with or without parentheses, but **reject** a **bare JSON string literal** (e.g., `PARAMETERS '{"a":1}'`). This is because the optional PARAMETERS can only be a MSJSON not varchar/nvarchar.
## What changed
### Grammar (`TSql170.g`)
- **Model name**:
- Replaced `schemaObjectThreePartName` with a **single-part** alternative:
- `Identifier` **or** `QuotedIdentifier` (one token).
- This allows `[dbo.MyDefaultModel]` (single token), but rejects dotted multi-part forms.
- **PARAMETERS**:
- Accept as **keyword** *or* **identifier** matched to `"Parameters"`.
- Value can be either:
- `PARAMETERS ( <expr> )` → wraps `<expr>` in a `ParenthesisExpression` to preserve parens.
- `PARAMETERS <expr>` → **guarded** to **forbid** a leading ASCII/Unicode **string literal** (blocks `PARAMETERS '{...}'`).
- No support added for `=` (kept “same as before” by design).
### Script generator (`SqlScriptGeneratorVisitor.AIGenerateEmbeddingsFunction.cs`)
- **Do not force parentheses** for `OptionalParameters`. Emit:
- `PARAMETERS {space} <fragment>`
- If the AST contains a `ParenthesisExpression`, it prints its own `(`…`)`. Bare expressions print without parens.
Before submitting your pull request, please ensure you have completed the following:
## Code Change
- [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
## Testing
- [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
## 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 ...
# 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 This PR added OPTIMIZE_FOR_ARRAY_SEARCH option for Json index. A test case is added. ---- #### AI description (iteration 1) #### PR Classification This PR introduces a new feature by adding support for the OPTIMIZE_FOR_ARRAY_SEARCH option in JSON indexes. #### PR Summary The changes enable the OPTIMIZE_FOR_ARRAY_SEARCH option in ScriptDom by updating parser mappings, constants, and test cases to validate the new JSON index syntax. - `SqlScriptDom/Parser/TSql/IndexOptionKind.cs`: Added a new enum value for OptimizeForArraySearch. - `SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs`: Introduced a new constant for OPTIMIZE_FOR_ARRAY_SEARCH. - `SqlScriptDom/Parser/TSql/IndexOptionHelper.cs`: Mapped the new index option to support the updated feature. - Test files (`Test/SqlDom/TestScripts/JsonIndexTests170.sql`, `Test/SqlDom/Baselines170/JsonIndexTests170.sql`, `Test/SqlDom/Only170SyntaxTests.cs`): Updated to include and validate the new JSON index option. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4709838
…ons for Json index # 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 This PR added a test case for PAD_INDEX and DROP_EXISTING options for Json index. These options are shared options with other indexes, so only a test case is needed. ---- #### AI description (iteration 1) #### PR Classification This PR adds new test cases to validate the PAD_INDEX and DROP_EXISTING options for JSON indexes. #### PR Summary The changes extend the JSON index tests by including scenarios for the PAD_INDEX and DROP_EXISTING options. - `Test/SqlDom/TestScripts/JsonIndexTests170.sql`: Adds a JSON index creation statement with PAD_INDEX and DROP_EXISTING options. - `Test/SqlDom/Baselines170/JsonIndexTests170.sql`: Updates the baseline to include the new JSON index command with PAD_INDEX and DROP_EXISTING options. - `Test/SqlDom/Only170SyntaxTests.cs`: Adjusts the expected error counts for JSON index tests to reflect the new options. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4711081
# 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
Sep 26, 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