Implement compare for map types - #9317
Conversation
`compare` bailed with "compare is not supported for dtype map(..)" for any
map-typed operand, which the `file_io` fuzz target hit when verifying a
round-trip by comparing the read-back array against the original.
A map row is the ordered sequence of its non-null `{key, value}` entry
structs, so it compares exactly like a list of those structs: entry-wise
first, then by entry count. That matches map scalar equality, which is
already positional over entries, and Vortex maps enforce neither key
uniqueness nor key ordering, so there is no canonical entry order to
normalize to first.
- Route `DType::Map` through the row-wise nested comparator, comparing the
entries list-view as values (its validity is the map's own validity, so
`build_comparator` would re-test it per row).
- Implement `Scalar` ordering for maps so the constant-constant fold in
`execute_compare` agrees with the array kernel.
Fixes #9297
Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
Signed-off-by: Claude <noreply@anthropic.com>
Merging this PR will degrade performance by 6.56%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Found by fuzzer in #9297. Map type comparison can delegate to the underlying list type