Repository navigation
Controlled Exception Handling for Incomplete VECTOR_SEARCH AST Nodes - #237
Closed
Fabian-Montero wants to merge 6 commits into
Closed
Fabian-Montero wants to merge 6 commits into
Fabian-Montero wants to merge 6 commits into
Conversation
Signed-off-by: Randy Villarreal <rvillarrealf@ucenfotec.ac.cr>
Signed-off-by: Randy Villarreal <rvillarrealf@ucenfotec.ac.cr>
Signed-off-by: Randy Villarreal <rvillarrealf@ucenfotec.ac.cr>
Docs/entregable 1
Fabian-Montero
requested review from
allancascante,
Karl Burtram (kburtram),
Leila Lali (llali) and
mhyon
as code owners
October 20, 2026 02:10
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
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.
Summary
Add controlled script-generation validation for incomplete
VECTOR_SEARCHAST nodes.Prevent the generator from silently producing invalid T-SQL when a manually constructed
VectorSearchTableReferencedoes not include the requiredMetricproperty.Implementation
Add validation in
SqlScriptGeneratorVisitor.ExplicitVisit(VectorSearchTableReference).Reject a
VECTOR_SEARCHnode withMetric == nullbefore generating any SQL tokens.Return:
VECTOR_SEARCH requires a METRIC value.Add an MSTest regression test that manually builds a VectorSearchTableReference without Metric and verifies that generation throws InvalidOperationException.
No ANTLR grammar, parser, generated AST code, or public API was changed.
TDD Evidence
RED: Without the validation guard, the focused test failed 1/1 because no InvalidOperationException was thrown and the generator silently produced invalid SQL.
GREEN: With the validation guard enabled, the same focused test passed 1/1.
Testing
Passed:
dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedName~VectorSearchWithoutMetricIsRejected"
dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedName
VectorSearchWithoutMetricIsRejected|FullyQualifiedNameTSql170SyntaxIn170ParserTest"dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1 --filter "FullyQualifiedName~TSql180SyntaxTests"
dotnet test Test/SqlDom/UTSqlScriptDom.csproj -c Debug -f net8.0 -m:1
The full net8.0 suite passed: 1,177 tests passed, 0 failed, and 0 skipped.