Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-14231

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

    XMLWordPrintableJSON

Details

    Description

      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)
      

      Attachments

        Issue Links

          Activity

            People

              lidavidm David Li
              thisisnic Nicola Crane
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 10m
                  4h 10m