Skip to content

Commit c6057dd

Browse files
committed
include test name in errors
1 parent 0142622 commit c6057dd

File tree

1 file changed

+17
-13
lines changed
  • datafusion/physical-expr/src/expressions

1 file changed

+17
-13
lines changed

datafusion/physical-expr/src/expressions/in_list.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ mod tests {
26302630
}
26312631

26322632
struct DictionaryInListTestCase {
2633-
_name: &'static str,
2633+
name: &'static str,
26342634
dict_type: DataType,
26352635
dict_keys: Vec<Option<i8>>,
26362636
dict_values: ArrayRef,
@@ -2722,7 +2722,7 @@ mod tests {
27222722
// Dictionary: keys [0, 1, null] → values ["a", "d", -]
27232723
// Rows: ["a", "d", null]
27242724
let utf8_case = DictionaryInListTestCase {
2725-
_name: "dictionary_utf8",
2725+
name: "dictionary_utf8",
27262726
dict_type: DataType::Dictionary(
27272727
Box::new(DataType::Int8),
27282728
Box::new(DataType::Utf8),
@@ -2742,7 +2742,7 @@ mod tests {
27422742
// Dictionary: keys [0, 1, null] → values [10, 20, -]
27432743
// Rows: [10, 20, null]
27442744
let int64_case = DictionaryInListTestCase {
2745-
_name: "dictionary_int64",
2745+
name: "dictionary_int64",
27462746
dict_type: DataType::Dictionary(
27472747
Box::new(DataType::Int8),
27482748
Box::new(DataType::Int64),
@@ -2773,7 +2773,7 @@ mod tests {
27732773
// Rows: [1.5, 3.7, null, NaN]
27742774
// Note: NaN is a value (not null), so it goes in the values array
27752775
let float64_case = DictionaryInListTestCase {
2776-
_name: "dictionary_float64",
2776+
name: "dictionary_float64",
27772777
dict_type: DataType::Dictionary(
27782778
Box::new(DataType::Int8),
27792779
Box::new(DataType::Float64),
@@ -2812,32 +2812,35 @@ mod tests {
28122812
};
28132813

28142814
// Execute all test cases
2815+
let test_name = utf8_case.name;
28152816
run_dictionary_in_list_test(utf8_case).map_err(|e| {
28162817
datafusion_common::DataFusionError::Execution(format!(
2817-
"Dictionary test failed for UTF8: {}",
2818-
e
2818+
"Dictionary test '{}' failed: {}",
2819+
test_name, e
28192820
))
28202821
})?;
28212822

2823+
let test_name = int64_case.name;
28222824
run_dictionary_in_list_test(int64_case).map_err(|e| {
28232825
datafusion_common::DataFusionError::Execution(format!(
2824-
"Dictionary test failed for Int64: {}",
2825-
e
2826+
"Dictionary test '{}' failed: {}",
2827+
test_name, e
28262828
))
28272829
})?;
28282830

2831+
let test_name = float64_case.name;
28292832
run_dictionary_in_list_test(float64_case).map_err(|e| {
28302833
datafusion_common::DataFusionError::Execution(format!(
2831-
"Dictionary test failed for Float64: {}",
2832-
e
2834+
"Dictionary test '{}' failed: {}",
2835+
test_name, e
28332836
))
28342837
})?;
28352838

28362839
// Additional test: Dictionary deduplication with repeated keys
28372840
// This tests that multiple rows with the same key (pointing to the same value)
28382841
// are evaluated correctly
28392842
let dedup_case = DictionaryInListTestCase {
2840-
_name: "dictionary_deduplication",
2843+
name: "dictionary_deduplication",
28412844
dict_type: DataType::Dictionary(
28422845
Box::new(DataType::Int8),
28432846
Box::new(DataType::Utf8),
@@ -2861,10 +2864,11 @@ mod tests {
28612864
dict_needle_test: None,
28622865
};
28632866

2867+
let test_name = dedup_case.name;
28642868
run_dictionary_in_list_test(dedup_case).map_err(|e| {
28652869
datafusion_common::DataFusionError::Execution(format!(
2866-
"Dictionary deduplication test failed: {}",
2867-
e
2870+
"Dictionary test '{}' failed: {}",
2871+
test_name, e
28682872
))
28692873
})?;
28702874

0 commit comments

Comments
 (0)