Skip to content

Fix regression after upstream merge#482

Merged
snaumenko-st merged 8 commits into
master-servicetitanfrom
fix-upstream-1
Apr 27, 2026
Merged

Fix regression after upstream merge#482
snaumenko-st merged 8 commits into
master-servicetitanfrom
fix-upstream-1

Conversation

@snaumenko-st
Copy link
Copy Markdown

@snaumenko-st snaumenko-st commented Apr 27, 2026

  • Fix QueryTranslationException from RecordSetHeader.Join dead code.
  • Fix SQL 2100-parameter limit in Bulk Update with large Contains.
  • Fix botched merge of TupleDescriptor single-arg ctor in PR Merge upstream #481

Remove an unused CreateTupleDescriptor(newColumns) call in RecordSetHeader.Join.

After upstream PR #248 changed the return statement to use the lazy two-arg TupleDescriptor(a, b) constructor, the local newTupleDescriptor became dead code. Combined with the later move of the >1000-column guard into LazyData (PR #204), this dead call eagerly tripped NotSupportedException during translation of complex queries whose transient joined headers exceed 1000 columns, even when the materialized recordset (after column pruning) would not.

Restore PR #204's lazy normalize-only body. The upstream merge kept the eager switch+Configure block but routed writes through the lazy Data property, forcing LazyData materialization (and the DO_MAX_1000_COLUMNS guard) at construction time. Deferring layout to LazyData removes the eager 1000-column trip during query translation and obviates the RecordSetHeader.Add workaround.

Add Xtensive.Orm.Tests.Core/Rse/RecordSetHeaderTest.cs with regression tests covering both Add overloads, Join, and the preserved runtime guard via LazyData access.

Remove an unused `CreateTupleDescriptor(newColumns)` call in
`RecordSetHeader.Join`. After upstream PR #248 changed the return
statement to use the lazy two-arg `TupleDescriptor(a, b)` constructor,
the local `newTupleDescriptor` became dead code. Combined with the
later move of the >1000-column guard into `LazyData` (PR #204), this
dead call eagerly tripped `NotSupportedException` during translation
of complex queries whose transient joined headers exceed 1000 columns,
even when the materialized recordset (after column pruning) would not.

Made-with: Cursor
snaumenko-st and others added 4 commits April 27, 2026 18:21
Switch `RecordSetHeader.CreateTupleDescriptor` (used by both `Add`
overloads) from `TupleDescriptor.Create` to `TupleDescriptor.CreateFromNormalized`,
matching the lazy normalization pattern already used by `Select` and
the upstream-optimized `Join`. The eager `Create` factory routes to
the single-arg `TupleDescriptor` constructor that synchronously
materializes `LazyData` and trips the >1000-column guard during
query translation, even when the resulting header is transient and
gets pruned before execution. This affected `IncludeProvider`-driven
translations of `Contains`-based predicates over already-wide
intermediate headers (e.g. `e.statusesList.Contains(e.Membership.Status)`
within complex multi-Select/SelectMany/GroupJoin chains).

Add `Xtensive.Orm.Tests.Core/Rse/RecordSetHeaderTest.cs` with
regression tests covering both `Add` overloads, `Join`, and the
preserved runtime guard via `LazyData` access.

Made-with: Cursor
Auto+TVP path of SqlDml.Variant lost its TvpTypeMapping because the
complex-condition branch always allocated a fresh QueryParameterBinding,
discarding the TVP binding the caller had just created. Reuse the
incoming binding so CommandFactory can switch to a single table-valued
parameter once the collection grows past MaxNumberOfConditions.

Adds regression tests covering Bulk Update Contains over 2200 ids/guids.

Made-with: Cursor
@snaumenko-st snaumenko-st changed the title Fix QueryTranslationException from RecordSetHeader.Join dead code Fix regression after upstream merge Apr 27, 2026
snaumenko-st and others added 2 commits April 27, 2026 21:08
Restore PR #204's lazy normalize-only body. The upstream merge kept
the eager switch+Configure block but routed writes through the lazy
`Data` property, forcing `LazyData` materialization (and the
DO_MAX_1000_COLUMNS guard) at construction time. Deferring layout to
`LazyData` removes the eager 1000-column trip during query translation
and obviates the `RecordSetHeader.Add` workaround.

Made-with: Cursor
@snaumenko-st snaumenko-st merged commit 61b8a50 into master-servicetitan Apr 27, 2026
34 checks passed
@snaumenko-st snaumenko-st deleted the fix-upstream-1 branch April 27, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants