mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
## Description
This PR adds missing affinity conversion to hash joins by applying
affinity conversion to build and probe keys before hashing.
```
turso> CREATE TABLE x(a INTEGER);
turso> CREATE TABLE y(b TEXT);
turso> INSERT INTO x VALUES (2),(3);
turso> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
turso> SELECT a, b
FROM x JOIN y ON a = b
ORDER BY a, b;
┌───┬─────┐
│ a │ b │
├───┼─────┤
│ 2 │ 02 │
├───┼─────┤
│ 2 │ 2 │
├───┼─────┤
│ 2 │ 2.0 │
└───┴─────┘
```
## Motivation and context
Fixes #3482.
Currently, Turso returns an empty result set:
```
turso> CREATE TABLE x(a INTEGER);
turso> CREATE TABLE y(b TEXT);
turso> INSERT INTO x VALUES (2),(3);
turso> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
turso> SELECT a, b
FROM x JOIN y ON a = b
ORDER BY a, b;
turso>
```
Expected behavior:
```
sqlite> CREATE TABLE x(a INTEGER);
sqlite> CREATE TABLE y(b TEXT);
sqlite> INSERT INTO x VALUES (2),(3);
sqlite> INSERT INTO y VALUES ('02'),('2'),('2.0'),('3x'),('3.5');
sqlite> SELECT a, b
...> FROM x JOIN y ON a = b
...> ORDER BY a, b;
2|02
2|2
2|2.0
```
## Description of AI Usage
This PR was developed with assistance from Claude Sonnet 4.5 through
code completions.
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes #4317
|
||
|---|---|---|
| .. | ||
| benches | ||
| ext | ||
| functions | ||
| incremental | ||
| index_method | ||
| io | ||
| json | ||
| mvcc | ||
| numeric | ||
| storage | ||
| time | ||
| translate | ||
| vdbe | ||
| vector | ||
| assert.rs | ||
| build.rs | ||
| Cargo.toml | ||
| error.rs | ||
| fast_lock.rs | ||
| function.rs | ||
| info.rs | ||
| lib.rs | ||
| parameters.rs | ||
| pragma.rs | ||
| pseudo.rs | ||
| schema.rs | ||
| series.rs | ||
| state_machine.rs | ||
| statement.rs | ||
| stats.rs | ||
| types.rs | ||
| util.rs | ||
| uuid.rs | ||
| vtab.rs | ||