Skip to content

fix: silent zero-match predicates — guid equality and like over list columns - #385

Open
protocolstardust wants to merge 2 commits into
RayforceDB:devfrom
protocolstardust:fix-guid-like-predicates
Open

fix: silent zero-match predicates — guid equality and like over list columns#385
protocolstardust wants to merge 2 commits into
RayforceDB:devfrom
protocolstardust:fix-guid-like-predicates

Conversation

@protocolstardust

Copy link
Copy Markdown
Collaborator

Two select-where predicate shapes returned zero rows without any error, discovered while benchmarking filters over a 13.9M-row splayed table.

GUID equality predicates matched nothing

(select {from: t where: (== guid_col g)}) returned an empty result at any table size:

  • the fused expression program has no 16-byte loads, so a compiled guid predicate read cells at the wrong width;
  • the elementwise fallback routed guid cells through the numeric loops with the same outcome.

Fix: the expression compiler bails GUID columns (EXPR_BAIL_GUID, mirroring the existing RAY_STR bail), and exec_elementwise_binary gets a memcmp branch for ==/!= over guid operands. Ordering operators over guids raise a type error instead of comparing garbage.

like over splayed string columns: type error direct, silent all-false in where

Splayed string columns load as a list of string atoms (col_load_str_list). ray_like_fn rejected that shape (str-find accepts it), and exec_like's fallback memset the result to all-false — so a like predicate over such a column, or over any unsupported column type, silently matched nothing.

Fix: ray_like_fn gets the list branch (mirroring str-find's), exec_like delegates the list case to it, and the silent memset is replaced with the type error the direct builtin raises.

Tests

  • test/rfl/query/guid_like_predicates.rfl — guid predicates find their rows, compose with aggregation, ordering raises; like over a list column in where; like over a numeric column raises.
  • test/rfl/strop/like.rfl — list-of-string/symbol inputs, mixed-type list raises.

Benchmark (13.9M-row splayed table, 10 cores)

predicate before after
where (== LCID g) 0 rows / workaround via mask 479 ms correct, 9.7 ms
where (like reason_text "*Pending*") 0 rows / workaround via str-find 121 ms correct, 62 ms

Both now within ~1.5x of kdb+ on the same data (6.5 / 50 ms).

The fused expression program has no 16-byte loads, and the elementwise
fallback routed GUID cells through the numeric loops — a guid equality
predicate silently returned zero rows at any table size. Bail GUID
columns out of the compiled program (EXPR_BAIL_GUID) and give the
fallback a memcmp branch for ==/!= over guid operands; ordering
operators raise a type error instead of comparing garbage.
Splayed string columns load as a list of string atoms
(col_load_str_list). ray_like_fn rejected that shape with a type error
while str-find accepted it, and exec_like's fallback memset the result
to all-false — a like predicate in select-where over such a column (or
any unsupported type) silently matched nothing. Add the list branch to
ray_like_fn (mirroring str-find), delegate exec_like's list case to it,
and replace the silent memset with the type error the direct builtin
raises.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant