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
|
||
|---|---|---|
| .. | ||
| cli_tests | ||
| javascript | ||
| sqlancer | ||
| sqlite3 | ||
| sqlite_test_ext | ||
| test_files | ||
| unreliable-libc | ||
| wal | ||
| affinity.test | ||
| agg-functions.test | ||
| all-mvcc.test | ||
| all.test | ||
| alter_column.test | ||
| alter_table.test | ||
| analyze.test | ||
| attach.test | ||
| autoincr.test | ||
| boolean.test | ||
| changes.test | ||
| cmdlineshell.test | ||
| coalesce.test | ||
| collate.test | ||
| compare.test | ||
| concat.test | ||
| create_index.test | ||
| create_table.test | ||
| default_value.test | ||
| delete.test | ||
| drop_index.test | ||
| drop_table.test | ||
| foreign_keys.test | ||
| gen-bigass-database.py | ||
| gen-database.py | ||
| glob.test | ||
| groupby.test | ||
| insert.test | ||
| integrity_check.test | ||
| join.test | ||
| json.test | ||
| like.test | ||
| literal.test | ||
| materialized_views.test | ||
| math.test | ||
| null.test | ||
| offset.test | ||
| orderby.test | ||
| partial_idx.test | ||
| pragma.test | ||
| pyproject.toml | ||
| README.md | ||
| returning.test | ||
| rollback.test | ||
| scalar-functions-datetime.test | ||
| scalar-functions-printf.test | ||
| scalar-functions.test | ||
| select.test | ||
| subquery.test | ||
| tester.tcl | ||
| testing.db | ||
| testing_norowidalias.db | ||
| testing_small.db | ||
| testing_user_version_10.db | ||
| time.test | ||
| total-changes.test | ||
| transactions.test | ||
| trigger.test | ||
| update.test | ||
| upsert.test | ||
| values.test | ||
| vector.test | ||
| views.test | ||
| vtab.test | ||
| where.test | ||
| window.test | ||
Turso Testing
Testing Extensions
When adding tests for extensions, please follow these guidelines:
- Tests that verify the internal logic or behavior of a particular extension should go into
cli_tests/extensions.py. - Tests that verify how extensions interact with the database engine, such as virtual table handling, should be written
in TCL (see
vtab.testas an example).
To check which extensions are available in TCL, or to add a new one, refer to the tester.tcl file and look at the extension_map.