You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2024/09/05 12:16:47 UTC
Re: [I] Incorrect behavior of arithmetic operations between time values [datafusion]
findepi commented on issue #12190:
URL: https://github.com/apache/datafusion/issues/12190#issuecomment-2331370861
> Just found something that could be interesting. I think it's a bug in the AST and the ~precedence~ order of operators.
Indeed, this is parsing problem.
I modified `datafusion/sql/tests/cases/plan_to_sql.rs` to include this:
```diff
--- datafusion/sql/tests/cases/plan_to_sql.rs
+++ datafusion/sql/tests/cases/plan_to_sql.rs
@@ -54,6 +54,12 @@ fn roundtrip_expr() {
"sum((age * 2))",
r#"sum((age * 2))"#,
),
+ (
+ TableReference::bare("person"),
+ "'2024-01-10 01:23:45'::timestamp - interval '1 day' - interval '2 day'",
+ // FIXME this is incorrect!
+ "(CAST('2024-01-10 01:23:45' AS TIMESTAMP) - (INTERVAL '0 YEARS 0 MONS 1 DAYS 0 HOURS 0 MINS 0.000000000 SECS' - INTERVAL '0 YEARS 0 MONS 2 DAYS 0 HOURS 0 MINS 0.000000000 SECS'))",
+ ),
];
let roundtrip = |table, sql: &str| -> Result<String> {
```
`DFParser` just wraps `sqlparser::parser::Parser`, just we will need to fix this in https://github.com/sqlparser-rs/sqlparser-rs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org