R/spark_hive.R

Defines functions apply_config create_hive_context

create_hive_context <- function(sc) {
  UseMethod("create_hive_context")
}

apply_config <- function(object, params, method, prefix) {
  if (!length(params)) {
    return(object)
  }

  params %>%
    purrr::map_if(is.logical, ~ (if (.x) "true" else "false")) %>%
    purrr::map_chr(as.character) %>%
    purrr::imap(~ list(key = .y, value = .x)) %>%
    purrr::reduce(~ invoke(.x, method, paste0(prefix, .y$key), .y$value), .init = object)
}

Try the sparklyr package in your browser

Any scripts or data that you put into this service are public.

sparklyr documentation built on Jan. 8, 2022, 5:06 p.m.