Skip to content

Commit 7667bc1

Browse files
committed
Per review, explicitly test for IN list type mismatch error
1 parent 8084010 commit 7667bc1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

datafusion/core/src/physical_planner.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3435,21 +3435,17 @@ mod tests {
34353435
}
34363436

34373437
#[tokio::test]
3438-
async fn in_list_types() -> Result<()> {
3439-
// expression: "c1 in ('a', 'b')" where c1 is Utf8
3440-
// Tests that IN list coercion works with compatible string types.
3441-
let list = vec![lit("a"), lit("b")];
3438+
async fn in_list_types_mixed_string_int_error() -> Result<()> {
3439+
// expression: "c1 in ('a', 1)" where c1 is Utf8
3440+
let list = vec![lit("a"), lit(1i64)];
34423441
let logical_plan = test_csv_scan()
34433442
.await?
3444-
// filter clause needs the type coercion rule applied
34453443
.filter(col("c12").lt(lit(0.05)))?
34463444
.project(vec![col("c1").in_list(list, false)])?
34473445
.build()?;
3448-
let execution_plan = plan(&logical_plan).await?;
3449-
3450-
let expected = r#"expr: BinaryExpr { left: BinaryExpr { left: Column { name: "c1", index: 0 }, op: Eq, right: Literal { value: Utf8("a"), field: Field { name: "lit", data_type: Utf8 } }, fail_on_overflow: false }"#;
3446+
let e = plan(&logical_plan).await.unwrap_err().to_string();
34513447

3452-
assert_contains!(format!("{execution_plan:?}"), expected);
3448+
assert_contains!(&e, "Cannot cast string 'a' to value of Int64 type");
34533449

34543450
Ok(())
34553451
}

0 commit comments

Comments
 (0)