Describe the bug
When performing an arithmetic operation on timestamps, now() causes an error when it is used as the LHS argument. It works as expected when it is used at the RHS argument.
Internal("If RHS of the operation is an array, then LHS also must be")
To Reproduce
The following will return an error and then panic on unwrap.
let ctx = SessionContext::new();
let df = ctx
.sql(
r#"
WITH cte AS (
SELECT now() AS dt
)
SELECT now() - cte.dt FROM cte
"#,
)
.await
.unwrap();
Expected behavior
The operation should be successfully evaluated.
Additional context
The following will run without issue. Note that now() is the RHS arg in this sample.
let ctx = SessionContext::new();
let df = ctx
.sql(
r#"
WITH cte AS (
SELECT now() AS dt
)
SELECT cte.dt - now() FROM cte
"#,
)
.await
.unwrap();