Skip to content

Commit

Permalink
Fix date expr to str
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Schmitz <[email protected]>
  • Loading branch information
Jonas Schmitz authored and ion-elgreco committed Nov 22, 2024
1 parent 0c4344f commit ec9be94
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/core/src/delta_datafusion/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl<'a> fmt::Display for ScalarValueFormat<'a> {
ScalarValue::Date32(e) => match e {
Some(e) => write!(
f,
"{}",
"'{}'::date",
NaiveDate::from_num_days_from_ce_opt(EPOCH_DAYS_FROM_CE + (*e)).ok_or(Error)?
)?,
None => write!(f, "NULL")?,
Expand Down Expand Up @@ -875,6 +875,18 @@ mod test {
)
)),
},
ParseTest {
expr: col("_date").eq(lit(ScalarValue::Date32(Some(18262)))),
expected: "_date = '2020-01-01'::date".to_string(),
override_expected_expr: Some(col("_date").eq(
Expr::Cast(
Cast {
expr: Box::from(lit("2020-01-01")),
data_type: arrow_schema::DataType::Date32
}
)
)),
},
];

let session: SessionContext = DeltaSessionContext::default().into();
Expand Down

0 comments on commit ec9be94

Please sign in to comment.