Skip to content

[C++] Can't cast from timestamp to utf8 when saving CSV #29811

@asfimport

Description

@asfimport

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.

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)

Reporter: Nicola Crane / @thisisnic
Assignee: David Li / @lidavidm

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-14231. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions