Skip to content

Commit

Permalink
Add debug print statement in coerce_case_expression and fix test proj…
Browse files Browse the repository at this point in the history
…ection output
  • Loading branch information
kosiew committed Jan 20, 2025
1 parent 9391aad commit 522459e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions datafusion/optimizer/src/analyzer/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ fn coerce_case_expression(case: Case, schema: &DFSchema) -> Result<Case> {
// Only one or the other can occur for a case expression, whilst then-else expression coercion will always occur

// prepare types
println!("==> coerce_case_expression");
let case_type = case
.expr
.as_ref()
Expand Down Expand Up @@ -901,7 +902,7 @@ fn coerce_case_expression(case: Case, schema: &DFSchema) -> Result<Case> {
.map(|expr| expr.cast_to(&then_else_coerce_type, schema))
.transpose()?
.map(Box::new);

println!("==> coerce_case_expression done");
Ok(Case::new(case_expr, when_then, else_expr))
}

Expand Down Expand Up @@ -2176,7 +2177,7 @@ mod test {
assert_analyzed_plan_eq(
Arc::new(TypeCoercion::new()),
plan,
"Projection: CAST(source_bar AS LargeList(Field { name: \"item\", data_type: Struct([Field { name: \"c0\", data_type: LargeUtf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })) = \
"aProjection: CAST(source_bar AS LargeList(Field { name: \"item\", data_type: Struct([Field { name: \"c0\", data_type: LargeUtf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })) = \
CAST(target_bar AS LargeList(Field { name: \"item\", data_type: Struct([Field { name: \"c0\", data_type: LargeUtf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }))\n \
EmptyRelation"
)?;
Expand Down

0 comments on commit 522459e

Please sign in to comment.