Skip to content

Add Hash indices#3976

Merged
Centril merged 2 commits intomasterfrom
centril/hash-indices
Jan 14, 2026
Merged

Add Hash indices#3976
Centril merged 2 commits intomasterfrom
centril/hash-indices

Conversation

@Centril
Copy link
Contributor

@Centril Centril commented Jan 8, 2026

Description of Changes

Fixes #1122.

Adds hash indices and exposes them through #[index(hash)] for Rust modules,
with support for typescript and C# to come in follow ups.
On the client/sdk side, for now, any index is backed via a BTree/native index as it is the most general.

A hash index may only be queried through point scan and never ranged scans.
Attempting a ranged scan results in an error, with the mechanism implemented in the previous PR (#3974).

API and ABI breaking changes

None

Expected complexity level and risk

2?

Testing

A test for ensuring that hash indices cannot be used for range scans is added.
Tests exercising hash indices will come in the next PR.

@Centril Centril changed the base branch from master to centril/index-error-handling-non-ranged January 8, 2026 15:32
@Centril Centril force-pushed the centril/index-error-handling-non-ranged branch from 8af3f83 to 540a61c Compare January 9, 2026 13:55
@Centril Centril force-pushed the centril/hash-indices branch from f2a54d2 to cd33f8b Compare January 9, 2026 14:02
@bfops bfops added release-1.11.2 release-1.12 enhancement New feature or request release-any To be landed in any release window and removed release-1.11.2 release-1.12 labels Jan 12, 2026
@Centril Centril force-pushed the centril/index-error-handling-non-ranged branch 3 times, most recently from d83a594 to da20694 Compare January 13, 2026 15:16
@Centril Centril force-pushed the centril/hash-indices branch from cd33f8b to cca9973 Compare January 13, 2026 15:42
@Centril Centril force-pushed the centril/index-error-handling-non-ranged branch from da20694 to a56bd01 Compare January 13, 2026 15:45
@Centril Centril force-pushed the centril/hash-indices branch from cca9973 to f68438f Compare January 13, 2026 15:46
Copy link
Contributor

@gefjon gefjon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. I'd appreciate better generic names in bindings/src/table.rs, but otherwise am good with this PR. I haven't really looked at the TypeScript, C# or Unreal codegen; ideally we should get @cloutiertyler or @coolreader18 , @rekhoff and @JasonAtClockwork respectively.

@JasonAtClockwork
Copy link
Contributor

Looks reasonable. I'd appreciate better generic names in bindings/src/table.rs, but otherwise am good with this PR. I haven't really looked at the TypeScript, C# or Unreal codegen; ideally we should get @cloutiertyler or @coolreader18 , @rekhoff and @JasonAtClockwork respectively.

I've double-checked and the impact to the Unreal codegen seems minor here and rebuilt Unreal Blackholio to test locally and it looks good to me.

@Centril
Copy link
Contributor Author

Centril commented Jan 14, 2026

The TS, C#, and C++ changes are very minor, as can be seen if you hide whitespace changes. They amount only to not caring what kind of index it is, treating all indices as a B-Tree, since B-Trees are "the most general". So the change is basically removing panics and using idx.algorithm.columns() instead of pattern matching on the index kind. Since this change is so minor, I'll take the liberty of merging the PR in the interest of time.

@Centril Centril force-pushed the centril/hash-indices branch from f68438f to a7f981f Compare January 14, 2026 08:41
@Centril Centril changed the base branch from centril/index-error-handling-non-ranged to master January 14, 2026 08:42
@Centril Centril enabled auto-merge January 14, 2026 08:56
@Centril Centril added this pull request to the merge queue Jan 14, 2026
Merged via the queue into master with commit 8544e6c Jan 14, 2026
27 of 28 checks passed
@Centril Centril deleted the centril/hash-indices branch January 15, 2026 09:46
cloutiertyler pushed a commit that referenced this pull request Jan 16, 2026
# Description of Changes

Fixes #1122.

Adds hash indices and exposes them through `#[index(hash)]` for Rust
modules,
with support for typescript and C# to come in follow ups.
On the client/sdk side, for now, any index is backed via a BTree/native
index as it is the most general.

A hash index may only be queried through point scan and never ranged
scans.
Attempting a ranged scan results in an error, with the mechanism
implemented in the previous PR
(#3974).



# API and ABI breaking changes

None

# Expected complexity level and risk

2?

# Testing

A test for ensuring that hash indices cannot be used for range scans is
added.
Tests exercising hash indices will come in the next PR.
clockwork-labs-bot added a commit that referenced this pull request Feb 18, 2026
When reading indexes back from the st_indexes system table,
StIndexAlgorithm::Hash was incorrectly converted to BTreeAlgorithm
instead of HashAlgorithm. This caused check_compatible to fail with
'Index algorithm mismatch' on any republish of a module containing
hash indexes, since the database schema would report BTree while
the module def specified Hash.

Introduced in #3976 (Add Hash indices) — the conversion imported
HashAlgorithm but used BTreeAlgorithm for the Hash variant.
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
## Description of Changes

One-line fix in `system_tables.rs`: when reading indexes back from
`st_index`, `StIndexAlgorithm::Hash` was incorrectly converted to
`BTreeAlgorithm` instead of `HashAlgorithm`.

This caused `check_compatible` to fail with `Index algorithm mismatch`
on **any** republish of a module containing hash indexes — the database
schema would report BTree while the module def specified Hash.
Effectively, any database with a hash index was stuck and could not be
updated.

### Root Cause

`system_tables.rs:1234` in the `From<StIndexAlgorithm> for
IndexAlgorithm` impl:
```rust
// Before (bug — introduced in #3976):
StIndexAlgorithm::Hash { columns } => BTreeAlgorithm { columns }.into(),

// After (fix):
StIndexAlgorithm::Hash { columns } => HashAlgorithm { columns }.into(),
```

The PR that added hash indices (#3976) imported `HashAlgorithm` but used
`BTreeAlgorithm` for the Hash variant conversion.

## API and ABI breaking changes

None.

## Expected complexity level and risk

1 — single word change, restores correct behavior.

## Testing

Existing schema tests cover index round-trips. The bug was caught by
attempting to republish a module with hash indexes.

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Kasama pushed a commit that referenced this pull request Feb 18, 2026
When reading indexes back from the st_indexes system table,
StIndexAlgorithm::Hash was incorrectly converted to BTreeAlgorithm
instead of HashAlgorithm. This caused check_compatible to fail with
'Index algorithm mismatch' on any republish of a module containing
hash indexes, since the database schema would report BTree while
the module def specified Hash.

Introduced in #3976 (Add Hash indices) — the conversion imported
HashAlgorithm but used BTreeAlgorithm for the Hash variant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hash Indexes

4 participants