vkhodygo opened a new issue, #36847:
URL: https://github.com/apache/arrow/issues/36847

   ### Describe the enhancement requested
   
   I have certain columns in my CSV files that are integers but stored as 
floats , i.e.,  years etc. 
   
   ```bash
   $ cat test.csv
   a,b
   1.0,2.1
   2.0,2
   3,3.33
   ```
   I'd like to read them as integers explicitly, and I do the following:
   
   ```R
   t <- open_csv_dataset("./test.csv",
                         skip = 1,
                         schema = schema(
                                         field("a", uint16(), nullable = FALSE),
                                         field("b", float32(), nullable = FALSE)
                                         )
   )
   
   t |> collect()
   
   Error in `compute.Dataset()`:
   ! Invalid: Could not open CSV input source '/home/usr/test.csv': Invalid: In 
CSV column #0: Row #2: CSV conversion error to uint16: invalid value '1.0'
   ℹ If you have supplied a schema and your data contains a header row, you 
should supply the argument `skip = 1` to prevent the header being read in as 
data.
   Run `rlang::last_trace()` to see where the error occurred.
   ```
   
   Obviously, I could follow 
https://github.com/apache/arrow/issues/12469#issuecomment-1046246626 and just 
cast, but this approach clutters the code. 
   
   @thisisnic What are your thoughts regarding this?
   
   
   ### Component(s)
   
   R


-- 
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]

Reply via email to