R/print__duckdb_explain.R

Defines functions print.duckdb_explain

Documented in print.duckdb_explain

#' DuckDB EXPLAIN query tree
#' @rdname duckdb_explain-class
#' @aliases duckdb_explain
#' @export
setClass("duckdb_explain", contains = "data.frame", slots = list(explain_key = "character", explain_value = "character"))

#' @rdname duckdb_explain-class
#' @usage NULL
#' @export
print.duckdb_explain <- function(x, ...) {
  if (!all(names(x) %in% c("explain_key", "explain_value"))) NextMethod("print")
  if (nrow(x) > 0 & all(!is.na(x))) cat(paste0(x$explain_key, "\n", x$explain_value, collapse = ""))
  invisible(x)
}

Try the duckdb package in your browser

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

duckdb documentation built on Oct. 30, 2024, 5:06 p.m.