You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/01 23:37:32 UTC

[GitHub] [arrow] jonkeane commented on a change in pull request #12474: ARROW-15599: [R] Convert a column as a sub-second timestamp from CSV file with the `T` col type option

jonkeane commented on a change in pull request #12474:
URL: https://github.com/apache/arrow/pull/12474#discussion_r817229371



##########
File path: r/tests/testthat/test-csv.R
##########
@@ -541,4 +541,16 @@ test_that("write_csv_arrow can write from RecordBatchReader objects", {
   tbl_in <- read_csv_arrow(csv_file)
   expect_named(tbl_in, c("dbl", "lgl", "false", "chr"))
   expect_equal(nrow(tbl_in), 3)
+
 })
+
+test_that("read_csv_arrow() can read sub-second timestamps with col_types T setting (ARROW-15599)", {
+  tbl <- tibble::tibble(time = c("2018-10-07 19:04:05.000", "2018-10-07 19:04:05.001"))
+  tf <- tempfile()
+  on.exit(unlink(tf))
+  write.csv(tbl, tf, row.names = FALSE)
+
+  df <- read_csv_arrow(tf, col_types = "T", col_names = "time", skip = 1)
+  expected <- as.POSIXct(tbl$time, tz = "UTC")
+  expect_equal(df$time, expected, ignore_attr = "tzone")
+})

Review comment:
       ```suggestion
   })
   
   ```

##########
File path: r/tests/testthat/test-csv.R
##########
@@ -541,4 +541,16 @@ test_that("write_csv_arrow can write from RecordBatchReader objects", {
   tbl_in <- read_csv_arrow(csv_file)
   expect_named(tbl_in, c("dbl", "lgl", "false", "chr"))
   expect_equal(nrow(tbl_in), 3)
+

Review comment:
       ```suggestion
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org