andygrove opened a new issue #957: URL: https://github.com/apache/arrow-datafusion/issues/957
**Describe the bug** I have a string column containing floating-point values but I want to cast this to an integer using `CAST(col AS int)` but this fails with `Cast error: Cannot cast string '1.20' to value of arrow::datatypes::types::Int32Type type`. However, we support casting floats to ints and I can do `CAST(CAST(col AS float) AS int)` to work around this but if I can do that, why can I not just cast to int directly? Is this the intended behavior? **To Reproduce** ```bash echo "1.2" > foo.csv ``` CLI: ```sql > CREATE EXTERNAL TABLE foo (bar VARCHAR) STORED AS CSV LOCATION 'foo.csv'; 0 rows in set. Query took 0.001 seconds. > SELECT bar FROM foo; +-----+ | bar | +-----+ | 1.2 | +-----+ 1 row in set. Query took 0.018 seconds. > SELECT CAST(bar AS int) FROM foo; ArrowError(ExternalError(ArrowError(CastError("Cannot cast string '1.2' to value of arrow::datatypes::types::Int32Type type")))) > SELECT CAST(CAST(bar as float) as int) FROM foo; +-------------------------------------+ | CAST(CAST(bar AS Float64) AS Int32) | +-------------------------------------+ | 1 | +-------------------------------------+ 1 row in set. Query took 0.017 seconds. ``` **Expected behavior** I would expect the cast to work. If there is working as intended then it would be good to document the behavior in the user guide. **Additional context** None -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org