From cea199f445f69425444cb7dc117d783201a4f1e8 Mon Sep 17 00:00:00 2001 From: Vardhireddy Yasaswini Date: Wed, 18 Dec 2024 03:02:40 +0000 Subject: [PATCH 1/5] Merged PR 1534420: Added tests for Fuzzy String Matching Intrinsics Added tests for below Fuzzy String Matching functions: EDIT_DISTANCE EDIT_DISTANCE_SIMILARITY JARO_WINKLER_DISTANCE JARO_WINKLER_SIMILARITY ---- #### AI description (iteration 1) #### PR Classification New feature: Added tests for fuzzy string matching intrinsics. #### PR Summary This pull request introduces new tests for fuzzy string matching functions. - Added `FuzzyStringMatchingTests160.sql` with test cases for `EDIT_DISTANCE`, `EDIT_DISTANCE_SIMILARITY`, `JARO_WINKLER_DISTANCE`, and `JARO_WINKLER_SIMILARITY`. - Updated `Only160SyntaxTests.cs` to include the new test script with zero expected errors. - Added baseline file `FuzzyStringMatchingTests160.sql` for the new test cases. --- .../Baselines160/FuzzyStringMatchingTests160.sql | 5 +++++ Test/SqlDom/Only160SyntaxTests.cs | 1 + .../TestScripts/FuzzyStringMatchingTests160.sql | 12 ++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql create mode 100644 Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql diff --git a/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql b/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql new file mode 100644 index 0000000..859f523 --- /dev/null +++ b/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql @@ -0,0 +1,5 @@ +SELECT EDIT_DISTANCE('sitting', 'kitten'); +SELECT EDIT_DISTANCE('sitting', 'kitten', 2); +SELECT EDIT_DISTANCE_SIMILARITY('hello1', NULL); +SELECT JARO_WINKLER_DISTANCE('', ''); +SELECT JARO_WINKLER_SIMILARITY('abcdefghij', 'jihgfedcba'); diff --git a/Test/SqlDom/Only160SyntaxTests.cs b/Test/SqlDom/Only160SyntaxTests.cs index 045425f..53beee6 100644 --- a/Test/SqlDom/Only160SyntaxTests.cs +++ b/Test/SqlDom/Only160SyntaxTests.cs @@ -38,6 +38,7 @@ public partial class SqlDomTests new ParserTest160("TrimFunctionTests160.sql", nErrors80: 7, nErrors90: 7, nErrors100: 7, nErrors110: 7, nErrors120: 7, nErrors130: 7, nErrors140: 4, nErrors150: 4), new ParserTest160("JsonFunctionTests160.sql", nErrors80: 9, nErrors90: 8, nErrors100: 14, nErrors110: 14, nErrors120: 14, nErrors130: 14, nErrors140: 14, nErrors150: 14), new ParserTest160(scriptFilename: "IgnoreRespectNullsSyntaxTests160.sql", nErrors80: 12, nErrors90: 8, nErrors100: 8, nErrors110: 8, nErrors120: 8, nErrors130: 8, nErrors140: 8, nErrors150: 8), + new ParserTest160(scriptFilename: "FuzzyStringMatchingTests160.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0), // OPENROWSET BULK statements specific to SQL Serverless Pools new ParserTest160(scriptFilename: "OpenRowsetBulkStatementTests160.sql", nErrors80: 8, nErrors90: 8, nErrors100: 8, nErrors110: 8, nErrors120: 8, nErrors130: 8, nErrors140: 8, nErrors150: 8), new ParserTest160(scriptFilename: "CreateStatisticsStatementTests160.sql", nErrors80: 4, nErrors90: 4, nErrors100: 4, nErrors110: 4, nErrors120: 4, nErrors130: 4, nErrors140: 4, nErrors150: 4), diff --git a/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql b/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql new file mode 100644 index 0000000..b6d416d --- /dev/null +++ b/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql @@ -0,0 +1,12 @@ +--EDIT_DISTANCE +SELECT EDIT_DISTANCE('sitting', 'kitten'); +SELECT EDIT_DISTANCE('sitting', 'kitten', 2); + +--EDIT_DISTANCE_SIMILARITY +SELECT EDIT_DISTANCE_SIMILARITY('hello1', NULL); + +--JARO_WINKLER_DISTANCE +SELECT JARO_WINKLER_DISTANCE('', ''); + +--JARO_WINKLER_SIMILARITY +SELECT JARO_WINKLER_SIMILARITY('abcdefghij', 'jihgfedcba'); \ No newline at end of file From e85eb6075f818a1899fa7da3bfaa8e7250452b7d Mon Sep 17 00:00:00 2001 From: C Shanmukha Reddy Date: Wed, 18 Dec 2024 07:25:44 +0000 Subject: [PATCH 2/5] Merged PR 1535135: Adding Regexp table valued functions parser tests Added Regexp TVFs to the sql script schema and added parser tests to validate in compatibility 170. Adding Regexp table valued functions parser tests ---- #### AI description (iteration 1) #### PR Classification New feature #### PR Summary This pull request adds tests for Regexp table-valued functions (TVFs) in SQL Server. - Added `Only170SyntaxTests.cs` to include new parser tests for Regexp TVFs. - Updated `ParserTest.cs` to include a new `ParserTest170` class for handling SQL Server 170 syntax. - Added test scripts `RegexpTVFTests170.sql` under `Baselines170` and `TestScripts` directories to validate Regexp TVFs. - Modified `CodeGenerationSupporter.cs` to include constants for `REGEXP_MATCHES` and `REGEXP_SPLIT_TO_TABLE`. - Updated `TSql170.g` to recognize `REGEXP_MATCHES` and `REGEXP_SPLIT_TO_TABLE` as valid functions. Related work items: #3584646 --- .../Parser/TSql/CodeGenerationSupporter.cs | 2 + SqlScriptDom/Parser/TSql/TSql170.g | 2 +- .../SqlDom/Baselines170/RegexpTVFTests170.sql | 21 +++++++ Test/SqlDom/Only170SyntaxTests.cs | 59 +++++++++++++++++++ Test/SqlDom/ParserTest.cs | 37 ++++++++++++ Test/SqlDom/TestScripts/RegexpTVFTests170.sql | 21 +++++++ 6 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 Test/SqlDom/Baselines170/RegexpTVFTests170.sql create mode 100644 Test/SqlDom/Only170SyntaxTests.cs create mode 100644 Test/SqlDom/TestScripts/RegexpTVFTests170.sql diff --git a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs index 918e01c..e3c34b4 100644 --- a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs +++ b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs @@ -798,6 +798,8 @@ internal static class CodeGenerationSupporter internal const string RecursiveTriggers = "RECURSIVE_TRIGGERS"; internal const string Recovery = "RECOVERY"; internal const string Regenerate = "REGENERATE"; + internal const string RegexpMatches = "REGEXP_MATCHES"; + internal const string RegexpSplitToTable = "REGEXP_SPLIT_TO_TABLE"; internal const string RejectType = "REJECT_TYPE"; internal const string RejectSampleValue = "REJECT_SAMPLE_VALUE"; internal const string RejectValue = "REJECT_VALUE"; diff --git a/SqlScriptDom/Parser/TSql/TSql170.g b/SqlScriptDom/Parser/TSql/TSql170.g index b6ba097..cdd6a12 100644 --- a/SqlScriptDom/Parser/TSql/TSql170.g +++ b/SqlScriptDom/Parser/TSql/TSql170.g @@ -18966,7 +18966,7 @@ selectTableReferenceElementWithoutJoinParenthesis[SubDmlFlags subDmlFlags] retur {NextTokenMatches(CodeGenerationSupporter.ChangeTable)}? vResult=changeTableTableReference | vResult=builtInFunctionTableReference - | {NextIdentifierMatchesOneOf(new string[] {CodeGenerationSupporter.StringSplit, CodeGenerationSupporter.GenerateSeries})}? + | {NextIdentifierMatchesOneOf(new string[] {CodeGenerationSupporter.StringSplit, CodeGenerationSupporter.GenerateSeries, CodeGenerationSupporter.RegexpMatches, CodeGenerationSupporter.RegexpSplitToTable})}? vResult=globalFunctionTableReference | vResult=variableTableReference | vResult=variableMethodCallTableReference diff --git a/Test/SqlDom/Baselines170/RegexpTVFTests170.sql b/Test/SqlDom/Baselines170/RegexpTVFTests170.sql new file mode 100644 index 0000000..9c28158 --- /dev/null +++ b/Test/SqlDom/Baselines170/RegexpTVFTests170.sql @@ -0,0 +1,21 @@ +DECLARE @text AS VARCHAR (100) = 'abcabc'; +DECLARE @pattern AS VARCHAR (10) = 'a+'; +DECLARE @flags AS CHAR (1) = 'i'; + +SELECT * +FROM REGEXP_MATCHES ('aaa', 'a'); +SELECT * +FROM REGEXP_MATCHES ('hello', 'he(l+)o', 'i'); +SELECT * +FROM REGEXP_MATCHES (@text, 'a'); +SELECT * +FROM REGEXP_MATCHES (@text, @pattern, @flags); + +SELECT * +FROM REGEXP_SPLIT_TO_TABLE ('aaa', 'a'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE ('hello', 'he(l+)o', 'i'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE (@text, 'a'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE (@text, @pattern, @flags); \ No newline at end of file diff --git a/Test/SqlDom/Only170SyntaxTests.cs b/Test/SqlDom/Only170SyntaxTests.cs new file mode 100644 index 0000000..88d968d --- /dev/null +++ b/Test/SqlDom/Only170SyntaxTests.cs @@ -0,0 +1,59 @@ +using Microsoft.SqlServer.TransactSql.ScriptDom; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SqlStudio.Tests.AssemblyTools.TestCategory; + +namespace SqlStudio.Tests.UTSqlScriptDom +{ + public partial class SqlDomTests + { + // Note: These filenames are case sensitive, make sure they match the checked-in file exactly + private static readonly ParserTest[] Only170TestInfos = + { + new ParserTest170("RegexpTVFTests170.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0, nErrors160: 0) + }; + + private static readonly ParserTest[] SqlAzure170_TestInfos = + { + // Add parser tests that have Azure-specific syntax constructs + // (those that have versioning visitor implemented) + // + }; + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TSql170SyntaxIn170ParserTest() + { + // Parsing both for Azure and standalone flavors + // + TSql170Parser parser = new TSql170Parser(true); + SqlScriptGenerator scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170); + foreach (ParserTest ti in Only170TestInfos) + { + ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170); + } + + // Parsing both for Azure and standalone flavors - explicitly set + // enum value to 'All' + // + parser = new TSql170Parser(true, SqlEngineType.All); + scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170); + scriptGen.Options.SqlEngineType = SqlEngineType.All; + foreach (ParserTest ti in Only170TestInfos) + { + ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170); + } + + // Explicitly ask for 'standalone' and parse + // + parser = new TSql170Parser(true, SqlEngineType.Standalone); + scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170); + scriptGen.Options.SqlEngineType = SqlEngineType.Standalone; + foreach (ParserTest ti in Only170TestInfos) + { + ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170); + } + } + + } +} \ No newline at end of file diff --git a/Test/SqlDom/ParserTest.cs b/Test/SqlDom/ParserTest.cs index cd432d6..3833faa 100644 --- a/Test/SqlDom/ParserTest.cs +++ b/Test/SqlDom/ParserTest.cs @@ -465,6 +465,43 @@ public ParserTest160(string scriptFilename, params ParserErrorInfo[] errors80And { } } + internal class ParserTest170 : ParserTest + { + public ParserTest170(string scriptFilename, int nErrors80, int nErrors90, int nErrors100, int nErrors110, int nErrors120, int nErrors130, int nErrors140, int nErrors150, int nErrors160) + : base( + scriptFilename, + new ParserTestOutput(nErrors80), new ParserTestOutput(nErrors90), new ParserTestOutput(nErrors100), + new ParserTestOutput(nErrors110), new ParserTestOutput(nErrors120), new ParserTestOutput(nErrors130), + new ParserTestOutput(nErrors140), new ParserTestOutput(nErrors150), new ParserTestOutput(nErrors160), + new ParserTestOutput("Baselines170")) + { } + + public ParserTest170(string scriptFilename, ParserTestOutput output80, ParserTestOutput output90, ParserTestOutput output100, + ParserTestOutput output110, ParserTestOutput output120, ParserTestOutput output130, ParserTestOutput output140, ParserTestOutput output150, ParserTestOutput output160) + : base( + scriptFilename, + output80, output90, output100, + output110, output120, + output130, + output140, + output150, + output160, + new ParserTestOutput("Baselines170")) + { } + + public ParserTest170(string scriptFilename, params ParserErrorInfo[] errors80And90And100And110And120and130and140and150and160) + : base( + scriptFilename, + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput(errors80And90And100And110And120and130and140and150and160), + new ParserTestOutput("Baselines170")) + { } + } + internal class ParserTest80And90 : ParserTest { public ParserTest80And90(string scriptFilename, int nErrors100) diff --git a/Test/SqlDom/TestScripts/RegexpTVFTests170.sql b/Test/SqlDom/TestScripts/RegexpTVFTests170.sql new file mode 100644 index 0000000..9c28158 --- /dev/null +++ b/Test/SqlDom/TestScripts/RegexpTVFTests170.sql @@ -0,0 +1,21 @@ +DECLARE @text AS VARCHAR (100) = 'abcabc'; +DECLARE @pattern AS VARCHAR (10) = 'a+'; +DECLARE @flags AS CHAR (1) = 'i'; + +SELECT * +FROM REGEXP_MATCHES ('aaa', 'a'); +SELECT * +FROM REGEXP_MATCHES ('hello', 'he(l+)o', 'i'); +SELECT * +FROM REGEXP_MATCHES (@text, 'a'); +SELECT * +FROM REGEXP_MATCHES (@text, @pattern, @flags); + +SELECT * +FROM REGEXP_SPLIT_TO_TABLE ('aaa', 'a'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE ('hello', 'he(l+)o', 'i'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE (@text, 'a'); +SELECT * +FROM REGEXP_SPLIT_TO_TABLE (@text, @pattern, @flags); \ No newline at end of file From f4374586a5c76b4ed305e286240d863e0cbb4650 Mon Sep 17 00:00:00 2001 From: Leila Lali Date: Mon, 6 Jan 2025 17:18:54 +0000 Subject: [PATCH 3/5] Merged PR 1537101: Adding missing eventname CREATE_VECTOR_INDEX Adding missing eventname CREATE_VECTOR_INDEX ---- #### AI description (iteration 1) #### PR Classification New feature #### PR Summary This pull request adds support for the `CREATE_VECTOR_INDEX` event name in the T-SQL parser. - `SqlScriptDom/Parser/TSql/EventNotificationEventType.cs`: Added `CreateVectorIndex` event type with value 344. --- SqlScriptDom/Parser/TSql/EventNotificationEventType.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs b/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs index 6fa1406..1339d63 100644 --- a/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs +++ b/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs @@ -1091,6 +1091,11 @@ public enum EventNotificationEventType /// DropExternalLanguage = 331, + /// + /// CREATE_VECTOR_INDEX + /// + CreateVectorIndex = 344, + /// /// AUDIT_LOGIN. /// From f531f13a2ab8b18ce1dcde3d518fc5b228914799 Mon Sep 17 00:00:00 2001 From: MerlinBot Date: Wed, 15 Jan 2025 21:22:31 +0000 Subject: [PATCH 4/5] [Security] Update .NET SDK to latest patch version --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 63f719f..7d8d343 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.404", + "version": "8.0.405", "rollForward": "latestMajor" }, "msbuild-sdks": { From 7c8836fc0a80d6e13151cd0332f059101a49338f Mon Sep 17 00:00:00 2001 From: Leila Lali Date: Fri, 17 Jan 2025 21:28:31 +0000 Subject: [PATCH 5/5] Merged PR 1548989: Adding Release notes for 170.12.0 and 170.15.0 Adding Release notes for 170.12.0 ---- #### AI description (iteration 1) #### PR Classification Documentation #### PR Summary This pull request adds release notes for version 170.12.0 of `Microsoft.SqlServer.TransactSql.ScriptDom`. - Added `release-notes/170.3/170.12.0.md` with details on target platform support, dependencies, and changes. - Notable changes include the removal of support for .NET Standard, dropping support for .NET 6, and adding support for .NET 8. --- release-notes/170/170.12.0.md | 25 +++++++++++++++++++++++++ release-notes/170/170.15.0.md | 22 ++++++++++++++++++++++ release-notes/{170.3 => 170}/170.3.0.md | 0 3 files changed, 47 insertions(+) create mode 100644 release-notes/170/170.12.0.md create mode 100644 release-notes/170/170.15.0.md rename release-notes/{170.3 => 170}/170.3.0.md (100%) diff --git a/release-notes/170/170.12.0.md b/release-notes/170/170.12.0.md new file mode 100644 index 0000000..3c65da3 --- /dev/null +++ b/release-notes/170/170.12.0.md @@ -0,0 +1,25 @@ +# Release Notes + +## Microsoft.SqlServer.TransactSql.ScriptDom 170.12.0 +This update brings the below changes over the previous release: + +### Target Platform Support + +* .NET Framework 4.6.2 (Windows x86, Windows x64) +* .NET 8 (Windows x86, Windows x64, Linux, macOS) + +### Dependencies +* Updates.NET SDK to latest patch version 8.0.404 + +#### .NET Framework +#### .NET Core + +### New Features +### Fixed + +### Changes +* Removed support for .NET Standard. +* Dropped support for .NET 6 +* Added support for .NET 8 + +### Known Issues diff --git a/release-notes/170/170.15.0.md b/release-notes/170/170.15.0.md new file mode 100644 index 0000000..80d66d2 --- /dev/null +++ b/release-notes/170/170.15.0.md @@ -0,0 +1,22 @@ +# Release Notes + +## Microsoft.SqlServer.TransactSql.ScriptDom 170.15.0 +This update brings the below changes over the previous release: + +### Target Platform Support + +* .NET Framework 4.6.2 (Windows x86, Windows x64) +* .NET 8 (Windows x86, Windows x64, Linux, macOS) + +### Dependencies +* Updates.NET SDK to latest patch version 8.0.404 + +#### .NET Framework +#### .NET Core + +### New Features +### Fixed +* Added support for WAIT_AT_LOW_PRIORITY in CREATE INDEX statement + +### Changes +### Known Issues diff --git a/release-notes/170.3/170.3.0.md b/release-notes/170/170.3.0.md similarity index 100% rename from release-notes/170.3/170.3.0.md rename to release-notes/170/170.3.0.md