Repro scripts admit vector(n,float16) and declare each parameter once (#4613) - #4626
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
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.
Fixes #4613
Refs erikdarlingdata/PerformanceStudio#592
Why
A Query Store plan's generated repro script left out SQL Server 2025's half-precision
vector(…,float16)parameters, because the data-type check the previous fix (#4567) installed didn't admit a two-part(n,name)suffix. Separately, a batch whose statements share a parameter — including auto-parameterized@0/@1names — declared that parameter once per statement and failed with "The variable name '@id' has already been declared" or "Must declare the scalar variable @1".What changes
Ports
erikdarlingdata/PerformanceStudio#592(merged6e52102) intoPerformanceMonitor.PlanAnalysis/ReproScriptBuilder.cs:IsValidDataType: the suffix now accepts(n),(max),(p,s), or(n,name)— the last form is what admitsvector(3,float16)./* No parameters declared: see the warnings above */).IsSafeLiteral's numeric-literal check switched from\dto[0-9], matching PerformanceStudio, so a compiled value using another script's digits (which\dalso matches but T-SQL doesn't read as numbers) still becomes a?placeholder.Hunk-by-hunk
validParameters/grouping/conflictingNames/declarableGroups/safeParameters/differingValueNamesblock — ported verbatim (adapted variable names already matched).droppedCountnow measured againstvalidParameters, plus the two new warnings (conflicting types, differing values) — ported.IsValidParameterName's\A…\zanchors and doc comment — already in PM from Plan analysis: the repro script matches PerformanceStudio's (#4564) #4567; not reapplied (would be a no-op).IsValidDataType's new suffix grammar (adds the(n,name)alternative) — ported.IsSafeLiteral's three regexes switched to\A…\z— already in PM from Plan analysis: the repro script matches PerformanceStudio's (#4564) #4567. Only the\d→[0-9]change in the numeric branch was new; ported that one line.ParseScriptcall in each test isn't present in PM (no T-SQL parser dependency in this project), so it's omitted; everyAssert.Contains/DoesNotContainline is kept.Everything else in PS's diff was already on PM's side from #4567 (the
\A/\zanchor switch,CommentSafe, no USE line on control characters, the leading-digit parameter name pattern).Consumers
Lite (
Lite/Analysis) and the Darling Viewer both build against the sharedReproScriptBuilderand needed no changes; their builds are 0 errors / 0 warnings with this change.Test plan
New class
Darling/Darling.Tests/PlanSync4613ReproScriptTests.csports PerformanceStudio's new tests (adapted: noParseScripthelper).RED on
origin/dev(4db597907, worktree at that commit): 8 of 28 tests in the new class failed, including thevector(3,float16)type-kept pin and the parameter-dedup pins. All 8 compiled fine on dev (no new members needed) — a genuine runtime RED, not a compile failure.Mutation: reverted
IsValidDataTypeto dev's pattern (no(n,name)suffix) against the otherwise-fixed code —vector(3,float16)and 3 other malformed-type pins went RED (4 of 28), confirming the pin is load-bearing. Reverted back; rebuilt green.GREEN after the full port:
(classes run:
PlanSync4613ReproScriptTests,PlanSync4564ReproScriptTests,ReproScriptBuilderHardeningTests,DocCommentHygieneTests,CommentFilterAdoptionTests)Builds, 0 warnings / 0 errors:
Darling.Tests,Lite.Tests,PerformanceMonitor.Darling.Viewer.Lite.Tests can't run in-process on macOS (WindowsBase discovery); no Lite test touches
ReproScriptBuilderdirectly, so none were run or skipped for this change.CHANGELOG
SECTION: Fixed
ENTRY: - The repro script declares each parameter once ([#4626]) - When a batch's plan lists the same parameter, or an auto-parameterized
@0/@1, for more than one statement, the repro script declared it once per statement and failed to run. Each name is now declared once; a name the statements give different types is left out with a warning, and a warning says when the statements' compiled values differ. Matches PerformanceStudio.REF: [#4626]: #4626