Skip to content

Support Option values in index filters#4949

Open
Mr-Dust0 wants to merge 3 commits into
clockworklabs:masterfrom
Mr-Dust0:issue-4824-filterable-option
Open

Support Option values in index filters#4949
Mr-Dust0 wants to merge 3 commits into
clockworklabs:masterfrom
Mr-Dust0:issue-4824-filterable-option

Conversation

@Mr-Dust0
Copy link
Copy Markdown
Contributor

@Mr-Dust0 Mr-Dust0 commented May 4, 2026

Summary

  • Add `FilterableValue` support for `Option` where `T` is already filterable.
  • Add Rust compile coverage for filtering option-valued btree indexes by `None`, `Some`, and option ranges.
  • Normalize TypeScript table-cache btree comparisons so `null` and `undefined` both behave as option-none.
  • Add C# source-generator coverage for nullable btree index accessors.

Fixes #4824.

Test Plan

  • `cargo check -p module-test`
  • `pnpm --dir crates/bindings-typescript test table_cache_resolved_indexes.test.ts`
  • `dotnet test crates/bindings-csharp/Codegen.Tests/Codegen.Tests.csproj --filter NullableBTreeIndexesCompile --no-restore`

@bfops
Copy link
Copy Markdown
Contributor

bfops commented May 12, 2026

Hi @Mr-Dust0 , please see the docs here about why this is more work than it may first appear: https://github.com/clockworklabs/SpacetimeDB/pull/4024/changes#diff-3ce7e5c02154d19ebe0624a457ea8b0c30a6b1658a24856ed1ea2ec3ee28916a.

@Mr-Dust0 Mr-Dust0 force-pushed the issue-4824-filterable-option branch from 04b404e to 9d7547d Compare May 13, 2026 05:36
@Mr-Dust0 Mr-Dust0 force-pushed the issue-4824-filterable-option branch from 9d7547d to b789158 Compare May 13, 2026 05:53
@Mr-Dust0
Copy link
Copy Markdown
Contributor Author

Hi @bfops, I’ve updated the PR to cover the additional work you shared in the docs.

The changes I've made add TypeScript module-side support for indexed/unique optional columns, keep non-filterable option types rejected at compile time, and normalize null/undefined option-none comparisons in the TypeScript table cache. I also kept the Rust and C# coverage in place.

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.

Implement FilterableValue for Option<T>

2 participants