You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by xu...@apache.org on 2022/06/22 14:29:38 UTC

[arrow-datafusion] branch master updated: minor: panic rather than fail silently on bad dictionary in hash join (#2767)

This is an automated email from the ASF dual-hosted git repository.

xudong963 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new e9423b81b minor: panic rather than fail silently on bad dictionary in hash join (#2767)
e9423b81b is described below

commit e9423b81bbbfb67d709f659ff00c85d96f586f25
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Jun 22 10:29:32 2022 -0400

    minor: panic rather than fail silently on bad dictionary in hash join (#2767)
---
 datafusion/core/src/physical_plan/hash_join.rs | 41 +++++++++++---------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/datafusion/core/src/physical_plan/hash_join.rs b/datafusion/core/src/physical_plan/hash_join.rs
index 96c652f35..825120dd9 100644
--- a/datafusion/core/src/physical_plan/hash_join.rs
+++ b/datafusion/core/src/physical_plan/hash_join.rs
@@ -961,17 +961,12 @@ macro_rules! equal_rows_elem_with_string_dict {
         let (left_values, left_values_index) = {
             let keys_col = left_array.keys();
             if keys_col.is_valid($left) {
-                let values_index = keys_col.value($left).to_usize().ok_or_else(|| {
-                    DataFusionError::Internal(format!(
-                    "Can not convert index to usize in dictionary of type creating group by value {:?}",
-                    keys_col.data_type()
-                ))
-                });
-
-                match values_index {
-                    Ok(index) => (as_string_array(left_array.values()), Some(index)),
-                    _ => (as_string_array(left_array.values()), None)
-                }
+                let values_index = keys_col
+                    .value($left)
+                    .to_usize()
+                    .expect("Can not convert index to usize in dictionary");
+
+                (as_string_array(left_array.values()), Some(values_index))
             } else {
                 (as_string_array(left_array.values()), None)
             }
@@ -979,24 +974,22 @@ macro_rules! equal_rows_elem_with_string_dict {
         let (right_values, right_values_index) = {
             let keys_col = right_array.keys();
             if keys_col.is_valid($right) {
-                let values_index = keys_col.value($right).to_usize().ok_or_else(|| {
-                    DataFusionError::Internal(format!(
-                    "Can not convert index to usize in dictionary of type creating group by value {:?}",
-                    keys_col.data_type()
-                ))
-                });
-
-                match values_index {
-                    Ok(index) => (as_string_array(right_array.values()), Some(index)),
-                    _ => (as_string_array(right_array.values()), None)
-                }
+                let values_index = keys_col
+                    .value($right)
+                    .to_usize()
+                    .expect("Can not convert index to usize in dictionary");
+
+                (as_string_array(right_array.values()), Some(values_index))
             } else {
                 (as_string_array(right_array.values()), None)
             }
         };
 
         match (left_values_index, right_values_index) {
-            (Some(left_values_index), Some(right_values_index)) => left_values.value(left_values_index) == right_values.value(right_values_index),
+            (Some(left_values_index), Some(right_values_index)) => {
+                left_values.value(left_values_index)
+                    == right_values.value(right_values_index)
+            }
             (None, None) => $null_equals_null,
             _ => false,
         }
@@ -1019,7 +1012,7 @@ fn equal_rows(
         .zip(right_arrays)
         .all(|(l, r)| match l.data_type() {
             DataType::Null => {
-                // lhs and rhs are both `DataType::Null`, so the euqal result
+                // lhs and rhs are both `DataType::Null`, so the equal result
                 // is dependent on `null_equals_null`
                 null_equals_null
             }