From 91aeda4f59cba0fbff245d52281be70a90e122d7 Mon Sep 17 00:00:00 2001 From: Gabriel Musat Mestre Date: Thu, 28 May 2026 11:50:20 +0200 Subject: [PATCH] Add bug reproducer --- .../simplify_expressions/simplify_exprs.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs b/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs index 3e495f5355103..15c03af044308 100644 --- a/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs +++ b/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs @@ -401,6 +401,29 @@ mod tests { Ok(()) } + #[test] + #[ignore = "Fails with: Cannot cast string '2013-07-01' to value of UInt16 type"] + fn test_simplify_filter_cast_string_literal_to_uint16() -> Result<()> { + let schema = Schema::new(vec![Field::new("event_date", DataType::UInt16, false)]); + let scan = table_scan(Some("test"), &schema, None)? + .build() + .expect("building scan"); + let plan = LogicalPlanBuilder::from(scan) + .filter(col("event_date").gt_eq(Expr::Cast(Cast::new( + Box::new(lit("2013-07-01")), + DataType::UInt16, + ))))? + .build()?; + + assert_optimized_plan_equal!( + plan, + @r#" + Filter: test.event_date >= CAST(Utf8("2013-07-01") AS UInt16) + TableScan: test + "# + ) + } + #[test] fn test_simplify_optimized_plan_with_or() -> Result<()> { let table_scan = test_table_scan();