Repository navigation
fix(join): hash and compare LIST key cells by value - #1376
Merged
Merged
Conversation
Collaborator
Author
|
Pushed eb92fff after the independent review:
Full suite: 5529/5533, 0 failed; the test passes at 2 and 8 cores and under ASan+UBSan. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A join on a LIST key column matched the wrong rows (#1373):
A's
[1]met B's[2]and[7 7], and[7 7]met nothing.Cause.
hash_row_keysandjoin_keys_eq(src/ops/join.c) read every key type other than STR, GUID and F64 throughread_col_i64. For a LIST column that is the cell's pointer, so rows hashed and compared by address.Fix.
ray_key_hash. Its span bits come fromray_key_spansover both sides' LIST key columns, computed once per join (join_key_flags) and carried beside the nullfree proof in the key flags every hash and compare already receives. A TIMESPAN-free LIST join hashes exactly; one holding a TIMESPAN cell uses the bitsatom_eqneeds.atom_eq, the equalitygroup,distinctandinuse. A LIST key meets only a LIST key, as STR meets only STR.Every hash-join route goes through these two functions, so inner, left, anti and semi joins all follow, on the parallel radix path too.
[7 7]meets[7 7],[0.5]meets[0.5], a TIMESPAN cell meets an equal I64/F64 cell, and atoms, nested lists and numeric cells meet by value. Full, asof and window joins already refuse LIST keys (domain/nyi), so they never compared pointers.Timing. 20k-row joins on table, dict and fractional-float LIST cells take 3–8 ms; hashing with every span bit took 10–25 s. 1M × 500k rows of
[i 5]cells: 115 ms at-c 1, 30 ms at-c 8. Ordinary I64/SYM/STR key joins are unchanged (cachegrind: under 0.1%).Limit. One TIMESPAN cell anywhere in either key column coarsens the hash for every row, as it does for
groupanddistinct, which share the hash: about 18 s for 20k table cells plus one span. Answers stay right.Tests.
rfl/join/list_key_join.rfl(@also-unfused) pins:It passes at 2 and 8 cores and under ASan+UBSan, and fails with dev's join.c. Dropping the span bits on either side fails it. An independent review compared a pairwise
atom_eqoracle over 106 cell kinds: inner both ways, left, anti, semi and anti-mask, single and multi-key, up to 70k × 70k at-c 1and-c 8, with and without TIMESPAN cells. All match. Full suite: 5529/5533 passed, 4 skipped, 0 failed.Fixes #1373