Skip to content

feat: translate the bridges from a range set to a value set (#650) - #653

Merged
CaffeinatedCoder merged 6 commits into
mainfrom
feat/650-range-set-to-value-set
Nov 30, 2026
Merged

CaffeinatedCoder merged 6 commits into
mainfrom
feat/650-range-set-to-value-set

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #650

Part of #407 (split into #650, #651, #652).

Problem

ToInt32Set(), ToInt64Set(), ToDateSet(), ToLocalDateSet() and ToYearMonthSet() ran in memory only: a filter over them failed to translate, and a final Select loaded the range set. The other direction, ToRangeSet(), runs as SQL since #487.

Change

All SQL measured by hand on PostgreSQL 16 and 18 first (int, bigint, date with every infinity form, month, empty, unbounded).

Tests

  • ValueBridgeTranslationTests (core) and NodaRangeBridgeTranslationTests (NodaTime): the whole statement per family, multiset vs sorted form, NULL, the null test, nesting under ToRangeSet().
  • ValueBridgeParityTests (integration, registered as a differential oracle): every subset of four ranges per family incl. the domain ends; projected, == the stored memory value, Contains per bound and neighbour, nullable column, ExecuteUpdate; unbounded raises; NodaTime from -infinity raises; raw rows another tool wrote. Green locally on PG 16 and 18.
  • RangeBridgeInfinityDisabledTests: the extremes as dates, and a stored infinity raises.
  • The old tests that held "stays in memory" (ClientSideOnlyTranslationTests, RangeBridgeTranslationTests.TheReverseConversion_IsNotTranslated, the NodaTime one, the projection case) failed with the change and are removed.
  • Seeds: value-bridge-drops-an-unbounded-range.patch and value-bridge-lists-the-extremes-as-dates.patch, each shown CAUGHT by ValueBridgeParityTests.

🤖 Generated with Claude Code

CaffeinatedCoder and others added 3 commits November 30, 2026 18:24
…a value set (#650)

ToInt32Set(), ToInt64Set(), ToDateSet(), ToLocalDateSet() and ToYearMonthSet() run in the
database: ARRAY((SELECT x FROM unnest(ranges) AS r CROSS JOIN generate_series(...) AS x
ORDER BY x)), built by the SQL guard after EF Core's alias pass, inside CASE WHEN ranges IS
NULL THEN NULL. An unbounded range raises (memory's message cast to the element type), a date
extreme is the sentinel Npgsql stores, a NodaTime range from -infinity raises, and with the
infinity conversions off a stored infinity raises. Measured on PostgreSQL 16 and 18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…without its sentinels (#650)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…650)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 30, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request breaking Changes an answer or a signature — needs a major area/range-set RangeSet and multirange algebra area/value-sets Value set families and wrapper arities package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime labels Nov 30, 2026
CaffeinatedCoder and others added 3 commits November 30, 2026 18:27
…-value-set

# Conflicts:
#	test/oracles/claims/docs-efcore.json
…tabase per type (#650)

On CI the class failed with 53300 (too many clients) after creating a database per assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CaffeinatedCoder
CaffeinatedCoder merged commit a29874a into main Nov 30, 2026
16 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/650-range-set-to-value-set branch November 30, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/range-set RangeSet and multirange algebra area/value-sets Value set families and wrapper arities breaking Changes an answer or a signature — needs a major enhancement New feature or request package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate the bridges from a range set to a value set (ToInt32Set and its siblings)

1 participant