Nicola Crane created ARROW-14231:
------------------------------------

             Summary: [C++] Can't cast from timestamp to utf8 when saving CSV
                 Key: ARROW-14231
                 URL: https://issues.apache.org/jira/browse/ARROW-14231
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Nicola Crane


The R code below creates a simple data frame containing a datetime (timestamp) 
object, but when I try to save this to disk I get an "unsupported cast" error.

{code:r}
library(arrow)
df <- tibble::tibble(datetime = as.POSIXct(c("2020-07-20 16:20", NA), tz = 
"UTC"))
write_csv_arrow(df, "df.csv")
# Error: NotImplemented: Unsupported cast from timestamp[us, tz=UTC] to utf8 
using function cast_string
# /home/nic2/arrow/cpp/src/arrow/compute/function.cc:215  DispatchBest(&inputs)
# /home/nic2/arrow/cpp/src/arrow/compute/cast.cc:229  Cast(Datum(value), 
to_type, options, ctx)
# /home/nic2/arrow/cpp/src/arrow/csv/writer.cc:101  compute::Cast(data, utf8(), 
compute::CastOptions(), &ctx)
# /home/nic2/arrow/cpp/src/arrow/csv/writer.cc:395  
column_populators_[col]->UpdateRowLengths(*batch.column(col), offsets_.data())
# /home/nic2/arrow/cpp/src/arrow/csv/writer.cc:324  
TranslateMinimalBatch(*batch)
# /home/nic2/arrow/cpp/src/arrow/csv/writer.cc:434  writer->WriteTable(table)
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to