dragosmg commented on code in PR #12589:
URL: https://github.com/apache/arrow/pull/12589#discussion_r864155935


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -357,6 +357,49 @@ register_bindings_duration <- function() {
     delta <- delta$cast(int64())
     start + delta$cast(duration("s"))
   })
+
+  register_binding("parse_date_time", function(x,
+                                               orders,
+                                               tz = "UTC") {
+
+    supported_orders <- c("ymd", "ydm", "mdy", "myd", "dmy", "dym")
+    unsupported_passed_orders <- setdiff(orders, supported_orders)
+
+    if (length(unsupported_passed_orders) > 0) {
+      arrow_not_supported(
+        paste0(
+          oxford_paste(
+            unsupported_passed_orders
+          ),
+          " `orders`"
+        )
+      )
+    }
+
+    # make all separators (non-letters and non-numbers) into "-"
+    x <- call_binding("gsub", "[^A-Za-z0-9]", "-", x)
+    # collapse multiple separators into a single one
+    x <- call_binding("gsub", "-{2,}", "-", x)
+
+    # TODO figure out how to parse strings that have no separators
+    # https://issues.apache.org/jira/browse/ARROW-16446
+    # we could insert separators at the "likely" positions, but it might be
+    # tricky given the possible combinations between dmy formats + locale

Review Comment:
   We have the Jira + this comment. Not quite sure how else to call attention 
to it. One of the main differences between the Arrow binding an lubridate's 
`parse_date_time()` is that there is no (and it looks like there won't be, at 
least for a while) any guessing / inference in Arrow. In lubridate, 
`guess_formats()` takes the `orders` argument and builds the most likely 
formats.  



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

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

Reply via email to