rok commented on code in PR #13506: URL: https://github.com/apache/arrow/pull/13506#discussion_r931723894
########## r/R/dplyr-datetime-helpers.R: ########## @@ -240,25 +214,24 @@ build_formats <- function(orders) { #' @noRd build_format_from_order <- function(order) { char_list <- list( - "y" = c("%y", "%Y"), - "m" = c("%m", "%B", "%b"), - "d" = "%d", - "H" = "%H", - "M" = "%M", - "S" = "%S", - "I" = "%I" + "%T" = "%H-%M-%S", + "%y" = c("%y", "%Y"), + "%m" = c("%m", "%B", "%b"), + "%b" = c("%m", "%B", "%b") ) - split_order <- strsplit(order, split = "")[[1]] + formats <- regmatches(order, gregexpr("(O{0,1}[a-zA-Z])", order))[[1]] + formats <- paste0("%", formats) + formats <- ifelse(formats %in% names(char_list), char_list[formats], formats) - outcome <- expand.grid(char_list[split_order]) + outcome <- expand.grid(formats) # we combine formats with and without the "-" separator, we will later # coalesce through all of them (benchmarking indicated this is a more # computationally efficient approach rather than figuring out if a string has # separators or not and applying only ) Review Comment: Done, @dragosmg does the new comment make sense? -- 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