Skip to content

Commit

Permalink
test: update type coercion test to assert expected failure for projec…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
kosiew committed Jan 17, 2025
1 parent b1a3fb1 commit f845a23
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions datafusion/optimizer/src/analyzer/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2188,11 +2188,13 @@ mod test {
let plan =
LogicalPlan::Projection(Projection::try_new(vec![expr], empty_relation)?);

match assert_analyzed_plan_eq(Arc::new(TypeCoercion::new()), plan, "") {
Ok(_) => panic!("Test failed: Coercion succeeded but was expected to fail"),
Err(_) => {} // Expected failure for now
}

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: {} })) = \
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"
)?;
Ok(())
}
}

0 comments on commit f845a23

Please sign in to comment.