Skip to content

Commit fe9b0ec

Browse files
committed
Revert some formatting
1 parent 1e6bf50 commit fe9b0ec

File tree

9 files changed

+26
-24
lines changed

9 files changed

+26
-24
lines changed

datafusion/core/src/physical_planner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2742,7 +2742,7 @@ mod tests {
27422742

27432743
assert_contains!(
27442744
&e,
2745-
r#"Error during planning: Can not find compatible types to compare Boolean with Struct(foo Boolean), Utf8"#
2745+
r#"Error during planning: Can not find compatible types to compare Boolean with [Struct(foo Boolean), Utf8]"#
27462746
);
27472747

27482748
Ok(())

datafusion/expr/src/conditional_expressions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ impl CaseBuilder {
8282
// Cannot verify types until execution type
8383
} else {
8484
let unique_types: HashSet<&DataType> = then_types.iter().collect();
85-
if unique_types.len() != 1 {
85+
if unique_types.is_empty() {
86+
return plan_err!("CASE expression 'then' values had no data types");
87+
} else if unique_types.len() != 1 {
8688
return plan_err!(
8789
"CASE expression 'then' values had multiple data types: {}",
8890
unique_types.iter().join(", ")

datafusion/expr/src/logical_plan/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Statement {
111111
Statement::Prepare(Prepare {
112112
name, data_types, ..
113113
}) => {
114-
write!(f, "Prepare: {name:?} {}", data_types.iter().join(", "))
114+
write!(f, "Prepare: {name:?} [{}]", data_types.iter().join(", "))
115115
}
116116
Statement::Execute(Execute {
117117
name, parameters, ..

datafusion/functions-nested/src/concat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl ScalarUDFImpl for ArrayConcat {
319319
}
320320
} else {
321321
plan_err!(
322-
"Failed to unify argument types of {}: {}",
322+
"Failed to unify argument types of {}: [{}]",
323323
self.name(),
324324
arg_types.iter().join(", ")
325325
)

datafusion/functions-nested/src/make_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl ScalarUDFImpl for MakeArray {
133133
Ok(vec![unified; arg_types.len()])
134134
} else {
135135
plan_err!(
136-
"Failed to unify argument types of {}: {}",
136+
"Failed to unify argument types of {}: [{}]",
137137
self.name(),
138138
arg_types.iter().join(", ")
139139
)

datafusion/functions-nested/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) fn check_datatypes(name: &str, args: &[&ArrayRef]) -> Result<()> {
4141
}) {
4242
let types = args.iter().map(|arg| arg.data_type()).collect::<Vec<_>>();
4343
return plan_err!(
44-
"{name} received incompatible types: '{}'.",
44+
"{name} received incompatible types: {}",
4545
types.iter().join(", ")
4646
);
4747
}

datafusion/optimizer/src/analyzer/type_coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
479479
get_coerce_type_for_list(&expr_data_type, &list_data_types);
480480
match result_type {
481481
None => plan_err!(
482-
"Can not find compatible types to compare {expr_data_type} with {}", list_data_types.iter().join(", ")
482+
"Can not find compatible types to compare {expr_data_type} with [{}]", list_data_types.iter().join(", ")
483483
),
484484
Some(coerced_type) => {
485485
// find the coerced type

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ mod tests {
489489
let result_type = get_coerce_type(expr_type, &list_types);
490490
match result_type {
491491
None => plan_err!(
492-
"Can not find compatible types to compare {expr_type} with {}",
492+
"Can not find compatible types to compare {expr_type} with [{}]",
493493
list_types.iter().join(", ")
494494
),
495495
Some(data_type) => {

datafusion/sql/tests/cases/params.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn test_prepare_statement_to_plan_no_param() {
155155
assert_snapshot!(
156156
plan,
157157
@r#"
158-
Prepare: "my_plan" Int32
158+
Prepare: "my_plan" [Int32]
159159
Projection: person.id, person.age
160160
Filter: person.age = Int64(10)
161161
TableScan: person
@@ -183,7 +183,7 @@ fn test_prepare_statement_to_plan_no_param() {
183183
assert_snapshot!(
184184
plan,
185185
@r#"
186-
Prepare: "my_plan"
186+
Prepare: "my_plan" []
187187
Projection: person.id, person.age
188188
Filter: person.age = Int64(10)
189189
TableScan: person
@@ -265,7 +265,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
265265
assert_snapshot!(
266266
plan,
267267
@r#"
268-
Prepare: "my_plan" Int32
268+
Prepare: "my_plan" [Int32]
269269
Projection: $1
270270
EmptyRelation: rows=1
271271
"#
@@ -290,7 +290,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
290290
assert_snapshot!(
291291
plan,
292292
@r#"
293-
Prepare: "my_plan" Int32
293+
Prepare: "my_plan" [Int32]
294294
Projection: Int64(1) + $1
295295
EmptyRelation: rows=1
296296
"#
@@ -315,7 +315,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
315315
assert_snapshot!(
316316
plan,
317317
@r#"
318-
Prepare: "my_plan" Int32, Float64
318+
Prepare: "my_plan" [Int32, Float64]
319319
Projection: Int64(1) + $1 + $2
320320
EmptyRelation: rows=1
321321
"#
@@ -376,7 +376,7 @@ fn test_prepare_statement_infer_types_from_join() {
376376
test.run(),
377377
@r#"
378378
** Initial Plan:
379-
Prepare: "my_plan" Int32
379+
Prepare: "my_plan" [Int32]
380380
Projection: person.id, orders.order_id
381381
Inner Join: Filter: person.id = orders.customer_id AND person.age = $1
382382
TableScan: person
@@ -424,7 +424,7 @@ fn test_prepare_statement_infer_types_from_predicate() {
424424
test.run(),
425425
@r#"
426426
** Initial Plan:
427-
Prepare: "my_plan" Int32
427+
Prepare: "my_plan" [Int32]
428428
Projection: person.id, person.age
429429
Filter: person.age = $1
430430
TableScan: person
@@ -476,7 +476,7 @@ fn test_prepare_statement_infer_types_from_between_predicate() {
476476
test.run(),
477477
@r#"
478478
** Initial Plan:
479-
Prepare: "my_plan" Int32, Int32
479+
Prepare: "my_plan" [Int32, Int32]
480480
Projection: person.id, person.age
481481
Filter: person.age BETWEEN $1 AND $2
482482
TableScan: person
@@ -533,7 +533,7 @@ fn test_prepare_statement_infer_types_subquery() {
533533
test.run(),
534534
@r#"
535535
** Initial Plan:
536-
Prepare: "my_plan" UInt32
536+
Prepare: "my_plan" [UInt32]
537537
Projection: person.id, person.age
538538
Filter: person.age = (<subquery>)
539539
Subquery:
@@ -598,7 +598,7 @@ fn test_prepare_statement_update_infer() {
598598
test.run(),
599599
@r#"
600600
** Initial Plan:
601-
Prepare: "my_plan" Int32, UInt32
601+
Prepare: "my_plan" [Int32, UInt32]
602602
Dml: op=[Update] table=[person]
603603
Projection: person.id AS id, person.first_name AS first_name, person.last_name AS last_name, $1 AS age, person.state AS state, person.salary AS salary, person.birth_date AS birth_date, person.😀 AS 😀
604604
Filter: person.id = $2
@@ -662,7 +662,7 @@ fn test_prepare_statement_insert_infer() {
662662
test.run(),
663663
@r#"
664664
** Initial Plan:
665-
Prepare: "my_plan" UInt32, Utf8, Utf8
665+
Prepare: "my_plan" [UInt32, Utf8, Utf8]
666666
Dml: op=[Insert Into] table=[person]
667667
Projection: column1 AS id, column2 AS first_name, column3 AS last_name, CAST(NULL AS Int32) AS age, CAST(NULL AS Utf8) AS state, CAST(NULL AS Float64) AS salary, CAST(NULL AS Timestamp(Nanosecond, None)) AS birth_date, CAST(NULL AS Int32) AS 😀
668668
Values: ($1, $2, $3)
@@ -681,7 +681,7 @@ fn test_prepare_statement_to_plan_one_param() {
681681
assert_snapshot!(
682682
plan,
683683
@r#"
684-
Prepare: "my_plan" Int32
684+
Prepare: "my_plan" [Int32]
685685
Projection: person.id, person.age
686686
Filter: person.age = $1
687687
TableScan: person
@@ -714,7 +714,7 @@ fn test_prepare_statement_to_plan_data_type() {
714714
// age is defined as Int32 but prepare statement declares it as DOUBLE/Float64
715715
// Prepare statement and its logical plan should be created successfully
716716
@r#"
717-
Prepare: "my_plan" Float64
717+
Prepare: "my_plan" [Float64]
718718
Projection: person.id, person.age
719719
Filter: person.age = $1
720720
TableScan: person
@@ -747,7 +747,7 @@ fn test_prepare_statement_to_plan_multi_params() {
747747
assert_snapshot!(
748748
plan,
749749
@r#"
750-
Prepare: "my_plan" Int32, Utf8View, Float64, Int32, Float64, Utf8View
750+
Prepare: "my_plan" [Int32, Utf8View, Float64, Int32, Float64, Utf8View]
751751
Projection: person.id, person.age, $6
752752
Filter: person.age IN ([$1, $4]) AND person.salary > $3 AND person.salary < $5 OR person.first_name < $2
753753
TableScan: person
@@ -790,7 +790,7 @@ fn test_prepare_statement_to_plan_having() {
790790
assert_snapshot!(
791791
plan,
792792
@r#"
793-
Prepare: "my_plan" Int32, Float64, Float64, Float64
793+
Prepare: "my_plan" [Int32, Float64, Float64, Float64]
794794
Projection: person.id, sum(person.age)
795795
Filter: sum(person.age) < $1 AND sum(person.age) > Int64(10) OR sum(person.age) IN ([$3, $4])
796796
Aggregate: groupBy=[[person.id]], aggr=[[sum(person.age)]]
@@ -831,7 +831,7 @@ fn test_prepare_statement_to_plan_limit() {
831831
assert_snapshot!(
832832
plan,
833833
@r#"
834-
Prepare: "my_plan" Int64, Int64
834+
Prepare: "my_plan" [Int64, Int64]
835835
Limit: skip=$1, fetch=$2
836836
Projection: person.id
837837
TableScan: person

0 commit comments

Comments
 (0)