-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to_timestamp
for negative values gives wrong result
#7802
Comments
/// to_timestamp SQL function
pub fn to_timestamp(args: &[ColumnarValue]) -> Result<ColumnarValue> {
handle::<TimestampNanosecondType, _, TimestampNanosecondType>(
args,
string_to_timestamp_nanos_shim,
"to_timestamp",
)
} The problem is that the function 'to_timestamp' treats all input as 'nano', which is causing an issue. |
it might be a bigger problem.....
|
I agree the difference with postgres seems related to the fact that https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TABLE
|
I'll prepare a fix to make |
Yes I think this is important. Also I was recently looking for a reference to the docs where we say "datafusion aims to have the postgres dialect" but could not find it 🤔 Do you know where it is? |
https://github.com/apache/arrow-datafusion/blob/main/datafusion/sqllogictest/README.md#running-tests-postgres-compatibility I plan to renew a bit a Datafusion main page to be more user-friendly and easier to start so we can include the PG compatibility statement there as well. |
That would be awesome -- thank you @comphead |
Describe the bug
In Datafusion
to_timestamp
builtin scalar function gives wrong result for negative valuesPG gives correct result
To Reproduce
Run
Expected behavior
Query results should match
Additional context
No response
The text was updated successfully, but these errors were encountered: