goldmedal commented on PR #13028: URL: https://github.com/apache/datafusion/pull/13028#issuecomment-2429558649
> Disallow non-integer types in [e6d1297](https://github.com/apache/datafusion/commit/e6d1297cb9045f99cab21690335740853fd91507) . Fractional values are more complicated than I expected, let's handle them later. @2010YOUY01 @findepi I think the floating value is caused by the DataFusion casting behavior is different from others. I tried to cast a float to an integer. ### DataFusion ``` DataFusion CLI v42.0.0 > select 1.5::int; +--------------+ | Float64(1.5) | +--------------+ | 1 | +--------------+ 1 row(s) fetched. Elapsed 0.055 seconds. > select 1.4::int; +--------------+ | Float64(1.4) | +--------------+ | 1 | +--------------+ 1 row(s) fetched. Elapsed 0.001 seconds. ``` ### Postgres ``` test=# select 1.5::int; int4 ------ 2 (1 row) test=# select 1.4::int; int4 ------ 1 (1 row) ``` ### DuckDB ``` D select 1.5::int; ┌──────────────────────┐ │ CAST(1.5 AS INTEGER) │ │ int32 │ ├──────────────────────┤ │ 2 │ └──────────────────────┘ D select 1.4::int; ┌──────────────────────┐ │ CAST(1.4 AS INTEGER) │ │ int32 │ ├──────────────────────┤ │ 1 │ └───── ``` Postgres and DuckDB are rounding but DataFusion is round down. So, that's why `limit 1.5` only returns 1 row in DataFusion but returns 2 rows in Postgres. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
