comphead commented on code in PR #7779:
URL: https://github.com/apache/datafusion-comet/pull/7779#discussion_r4743962285
##########
native/spark-expr/src/hash_funcs/utils.rs:
##########
@@ -492,47 +452,11 @@ macro_rules! hash_list_with_primitive_elements {
}
DataType::Utf8 => {
let elem_array =
$values.as_any().downcast_ref::<StringArray>().unwrap();
- if $list_array.null_count() == 0 && elem_array.null_count() ==
0 {
- for (row_idx, hash) in
$hashes_buffer.iter_mut().enumerate() {
- let start = row_idx * $list_size;
- for elem_idx in 0..$list_size {
- *hash = $hash_method(elem_array.value(start +
elem_idx), *hash);
- }
- }
- } else {
- for (row_idx, hash) in
$hashes_buffer.iter_mut().enumerate() {
- if !$list_array.is_null(row_idx) {
- let start = row_idx * $list_size;
- for elem_idx in 0..$list_size {
- if !elem_array.is_null(start + elem_idx) {
- *hash =
$hash_method(elem_array.value(start + elem_idx), *hash);
- }
- }
- }
- }
- }
+ $crate::hash_list_primitive!(fixed_size: $list_size,
$list_array, elem_array, $hashes_buffer, $hash_method, |v| v);
Review Comment:
These `fixed_size:` arms for `Utf8` and `Binary` (and the `offsets:` arm for
`Binary`) are not asserted against known hashes anywhere I could find. The
Scala test `hash - array of strings` in `CometHashExpressionSuite.scala` only
reaches the `offsets:` `Utf8` arm, because Spark cannot produce a
`FixedSizeList`. `decimal_lists_match_independent_binary_encoding` at the
bottom of this file builds its expected side from a `BinaryArray` list, but
that side goes through the macro this PR changes, so a bug in the shared arm
would affect both sides and still pass. A small Rust test that hashes `List`,
`LargeList` and `FixedSizeList` of `StringArray` and `BinaryArray` (with parent
and child nulls) and compares to per-element chained `spark_murmur3_hash` and
`spark_xxhash64` calls on the flat array would pin all four arms. I found no
SQL file tests using `hash(array(<string>))` (the matches for `hash(array(` in
`sql-tests` are for calendar interval, float and struct inputs).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]