You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Update RFC-0201 Phase 2a and 2b mission status
Phase 2a:
- Mark as Complete
- Document SipHash-2-4 implementation
- Note Phase 2d/2e are out of scope for stoolap
Phase 2b:
- Mark as Complete
- Document bug fix (ComparisonValue::Blob missing)
- Note commit reference
Copy file name to clipboardExpand all lines: missions/claimed/rfc-0201-phase-2a-hash-index-blob.md
+60-57Lines changed: 60 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Status
4
4
5
-
Claimed
5
+
**Complete** ✅
6
6
7
7
## Claimant
8
8
@@ -31,30 +31,66 @@ CREATE INDEX idx_api_keys_hash ON api_keys(key_hash) USING HASH;
31
31
- O(1) average equality lookup
32
32
-**Fallback mode (required):** If hash index cannot be rebuilt after key loss, database opens with hash index disabled. Queries fall back to full scans.
33
33
34
-
**stoolap implementation status:**
35
-
-`HashIndex` exists in `src/storage/index/hash.rs` using `ahash`
36
-
-`Value::hash` already handles `Value::Blob` via standard hasher
37
-
- Current ahash may not be SipHash - need to verify or implement SipHash
38
-
39
34
## Acceptance Criteria
40
35
41
-
-[ ] Hash index functional with `Value::Blob` keys
42
-
-[ ] Round-trip test: insert blob, lookup by blob value
43
-
-[ ] Fallback mode works when hash index is disabled
**Root Cause:**`ComparisonValue::from_value()` converted `Value::Blob` to `ComparisonValue::Text(String::new())` (empty string), causing ALL blob comparisons in WHERE clauses to return 0 rows.
49
39
50
-
```rust
51
-
implPartialEqforValue::Blob {
52
-
fneq(&self, other:&Self) ->bool {
53
-
// Byte-by-byte comparison
54
-
self.0==other.0
55
-
}
56
-
}
57
-
```
40
+
**Fix Applied:**
41
+
1. Added `ComparisonValue::Blob(Vec<u8>)` variant
42
+
2. Proper conversion in `from_value()`: `Value::Blob(data) => ComparisonValue::Blob(data.to_vec())`
43
+
3. Added `compare_blobs()` method for byte-by-byte comparison
44
+
4. Added blob match arms in `evaluate()` and `evaluate_fast()`
58
45
59
-
The expression VM's `evaluate_binary_op` for `=` should call `Value::eq` which uses this implementation.
46
+
## Completed
60
47
61
-
### Expected Behavior
62
-
63
-
```sql
64
-
CREATETABLEt (id INTEGER, key BYTEA(32));
65
-
INSERT INTO t VALUES (1, x'0102030405060708091011121314151617181920212223242526272829303132');
66
-
INSERT INTO t VALUES (2, x'0102030405060708091011121314151617181920212223242526272829303132');
67
-
INSERT INTO t VALUES (3, x'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
68
-
69
-
-- Returns row 1 (exact match)
70
-
SELECT*FROM t WHERE key = x'0102030405060708091011121314151617181920212223242526272829303132';
71
-
72
-
-- Returns rows 1 and 2 (both start with 01... but only 1 and 2 are identical)
73
-
SELECT*FROM t WHERE key = key;
74
-
75
-
-- Returns row 3 (different from the other two)
76
-
SELECT*FROM t WHERE key <> key;
77
-
```
48
+
- ✅ **Bug fixed** in `src/storage/expression/comparison.rs`
0 commit comments