fix(query): reject STR equality keys in asof-join and window-join - #400
Conversation
Both kernels read equality-key cells through read_col_i64, which has no RAY_STR case: a STR column falls into the byte-wide default. asof-join (via asof_eq_lread) mismatches outright — a key that should match nulls out; window-join / window-join1 read one byte per row when they sort and probe the right side, so once there are more distinct keys than fit in a byte the collisions cross-contaminate groups and the aggregates are wrong. Neither surfaces an error, so callers get silently corrupt data. The base inner/left/anti joins use a separate STR-aware kernel and stay correct, so scope the fix to the two window/asof kernels: decline a STR equality key on either side with nyi (parted columns unwrapped to their base type first). One guard in ray_asof_join_core covers both asof call paths; one in window_join_impl covers window-join and window-join1. Adds test/rfl/join/str_key_nyi.rfl covering the nyi rejection, the SYM keys that must keep working (order-independent), and the base joins that must NOT be over-rejected on STR keys.
|
Blocking: the new The guard is inside the It still returns Please add the validation to the legacy fallthrough as well (or, preferably, reject For context, the previous related fixes covered adaptive-width/cross-domain |
Problem
asof-join,window-join, andwindow-join1accept string (STR) equality-key columns and then return silently wrong results — no error, corrupt data.Root cause: all three read equality-key cells through
read_col_i64, which has noRAY_STRcase, so aSTRcolumn falls into the byte-wide default (((uint8_t*)data)[row]).asof-join (
asof_eq_lread) mismatches outright — a key that should match nulls out:window-join / window-join1 read one byte per row when they sort and probe the right side. Small key sets coincide by luck, but once there are more distinct keys than fit in a byte the collisions cross-contaminate groups:
Fix
The base
inner-join/left-join/anti-joinuse a separate STR-aware kernel (ray_join/ray_antijoin) and stay correct even with 300 distinct STR keys (verified), so this is scoped to the two window/asof kernels only.Decline a
STRequality key on either side withnyiinstead of returning corrupt data (parted columns unwrapped to their base type first, matching the base join). One guard inray_asof_join_corecovers both asof call paths (plain + parted/day); one inwindow_join_implcovers bothwindow-joinandwindow-join1.nyi(rather than adding STR support to these kernels) is the conservative bug fix: it turns silent corruption into an explicit, catchable error. Real STR eq-key support in the window/asof kernels can be a follow-up.Tests
test/rfl/join/str_key_nyi.rfl:STReq-key ->nyiforasof-join(both operand orders),window-join,window-join1;SYMeq-keys keep working and stay order-independent on the right side;inner-join/anti-joinwithSTRkeys must not be over-rejected (regression guard).make test: 3673 of 3674 passed (1 skipped, 0 failed).