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/02/10 16:49:12 UTC

[GitHub] [arrow] dragosmg commented on a change in pull request #12353: ARROW-14471: [R] Implement lubridate's date/time parsing functions

dragosmg commented on a change in pull request #12353:
URL: https://github.com/apache/arrow/pull/12353#discussion_r803882802



##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -148,4 +148,56 @@ register_bindings_datetime <- function() {
     !call_binding("am", x)
   })
 
+  register_binding("ymd", function(x) {
+    format_map <-
+      list(
+        ymd_hyphen1 = "%Y-%m-%d",
+        ymd_hyphen2 = "%y-%m-%d",
+        ymd_hyphen3 = "%Y-%B-%d",
+        ymd_hyphen4 = "%y-%B-%d",
+        ymd_hyphen5 = "%Y-%b-%d",
+        ymd_hyphen6 = "%y-%b-%d",

Review comment:
       Reducing the formats works (I might have to implement it in several steps to handle `" "` and multiple instances of the same separator). There are a couple of outstanding issues:
   
   * `coalesce()` needs the first call to `call_binding("strptime")` to return `NA` in order to move on to the second one and so on. Instead the first call errors and the second one never get evaluated. `tryCatch()` doesn't seem to work in this context.
   * short (`"%y"`) vs long (`"%Y"`) years. If the string contains a short year (e.g. "19") libarrrow will not error for the first format, but instead return `0019`.  




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