~hrbrmstr/sergeant

39583d16cb841ac03a391d938bcfc5ccfb142d04 — hrbrmstr 2 years ago 7492645
minor fixes
M NAMESPACE => NAMESPACE +1 -0
@@ 18,6 18,7 @@ export(drill_functions)
export(drill_metrics)
export(drill_mod_storage)
export(drill_options)
export(drill_opts)
export(drill_profile)
export(drill_profiles)
export(drill_query)

M NEWS.md => NEWS.md +2 -0
@@ 13,6 13,8 @@
- New `option()` => "`sergeant.bigint.warnonce`" to control `BIGINT` 
  warnings. Use `options(sergeant.bigint.warnonce = FALSE)` 
- Fixed bug in `dbListFields()` (`DrillConnection-class`)
- Added `as.integer64()` `dplyr` custom Drill function to convert
  columns to `BIGINT`

# sergeant 0.7.0-BETA


M R/custom.r => R/custom.r +1 -0
@@ 17,6 17,7 @@
#' the link found in the `DESCRIPTION` file.
#'
#' - `as.character(x)` : `CAST( x AS CHARACTER )`
#' - `as.integer64(x)` : `CAST( x AS BIGINT )`
#' - `as.date(x)` : `CAST( x AS DATE )`
#' - `as.logical(x)` : `CAST( x AS BOOLEAN) `
#' - `as.numeric(x)` : `CAST( x AS DOUBLE )`

M R/dplyr.r => R/dplyr.r +1 -0
@@ 183,6 183,7 @@ sql_translate_env.DrillConnection <- function(con) {
    scalar = dbplyr::sql_translator(
      .parent = dbplyr::base_scalar,
      `!=` = dbplyr::sql_infix("<>"),
      as.integer64 = function(x) build_sql("CAST(", x, "AS BIGINT)"),
      as.numeric = function(x) build_sql("CAST(", x, " AS DOUBLE)"),
      as.character = function(x) build_sql("CAST(", x, " AS CHARACTER)"),
      as.date = function(x) build_sql("CAST(", x, " AS DATE)"),

M R/sergeant.r => R/sergeant.r +40 -1
@@ 335,7 335,7 @@ drill_functions <- function(drill_con, browse=FALSE) {
    if (!requireNamespace("DT", quietly = TRUE)) {
      warning("The DT must be installed to use this function")
    } else {
      DT::datatable(out, options = list(pageLength = 100))
      print(DT::datatable(out, options = list(pageLength = 100)))
    }
  }



@@ 343,6 343,45 @@ drill_functions <- function(drill_con, browse=FALSE) {

}

#' Show all the available Drill options
#'
#' @md
#' @param drill_con drill server connection object setup by \code{drill_connection()}
#' @param browse if `TRUE` display an HTML interacrtive HTML widget with the options
#'        as well as reutrn the data frame with the options Default if `FALSE`.
#' @note You _must_ be using Drill 1.15.0+ to use this function
#' @export
#' @return data frame
#' @family Dill direct REST API Interface
#' @references \href{https://drill.apache.org/docs/querying-system-tables/#querying-the-options-table}{Drill documentation}
#' @examples \dontrun{
#' drill_connection() %>% drill_opts()
#' }
drill_opts <- function(drill_con, browse=FALSE) {

  stopifnot(utils::compareVersion(drill_version(drill_con), "1.15.0") >= 0)

  if (inherits(drill_con, "src_drill")) {
    dplyr::collect(
      dplyr::tbl(drill_con, dplyr::sql("(SELECT * FROM sys.options)"))
    ) -> out
  } else {
    drill_query(
      drill_con = drill_con,
      query = "SELECT * FROM sys.options",
      uplift = TRUE,
      .progress = FALSE
    ) -> out
  }

  if (browse) {
    if (!requireNamespace("DT", quietly = TRUE)) {
      warning("The DT must be installed to use this function")
    } else {
      print(DT::datatable(out, options = list(pageLength = 100)))
    }
  }

  out

}

M README.Rmd => README.Rmd +3 -1
@@ 62,7 62,8 @@ Note that a number of Drill SQL functions have been mapped to R functions (e.g. 
- `drill_jdbc`:	Connect to Drill using JDBC
- `drill_metrics`:	Get the current memory metrics
- `drill_options`:	List the name, default, and data type of the system and session options
- `drill_profile`:	Get the profile of the query that has the given query id
- `drill_popts`: Show all the available Drill options (1.15.0+)
- `drill_rofile`:	Get the profile of the query that has the given query id
- `drill_profiles`:	Get the profiles of running and completed queries
- `drill_query`:	Submit a query and return results
- `drill_set`:	Set Drill SYSTEM or SESSION options


@@ 78,6 79,7 @@ Note that a number of Drill SQL functions have been mapped to R functions (e.g. 
- `drill_use`:	Change to a particular schema.
- `drill_version`:	Identify the version of Drill running


## Installation

```{r eval=FALSE}

M README.md => README.md +2 -1
@@ 83,7 83,8 @@ function mappings.
  - `drill_functions`: Show all the available Drill built-in functions & UDFs (Apache Drill 1.15.0+ required)
  - `drill_jdbc`: Connect to Drill using JDBC
  - `drill_metrics`: Get the current memory metrics
  - `drill_options`: List the name, default, and data type of the system
  - `drill_optis`: Show all the available Drill options (1.15.0+)
  - `drill_optons`: List the name, default, and data type of the system
    and session options
  - `drill_profile`: Get the profile of the query that has the given
    query id

M man/drill_active.Rd => man/drill_active.Rd +1 -1
@@ 22,7 22,7 @@ Other Dill direct REST API Interface: \code{\link{drill_cancel}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_cancel.Rd => man/drill_cancel.Rd +1 -1
@@ 22,7 22,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_connection.Rd => man/drill_connection.Rd +1 -1
@@ 33,7 33,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_cancel}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_custom_functions.Rd => man/drill_custom_functions.Rd +1 -0
@@ 22,6 22,7 @@ If you want a particular custom function mapped, file a PR or issue request in
the link found in the \code{DESCRIPTION} file.
\itemize{
\item \code{as.character(x)} : \code{CAST( x AS CHARACTER )}
\item \code{as.integer64(x)} : \code{CAST( x AS BIGINT )}
\item \code{as.date(x)} : \code{CAST( x AS DATE )}
\item \code{as.logical(x)} : \code{CAST( x AS BOOLEAN) }
\item \code{as.numeric(x)} : \code{CAST( x AS DOUBLE )}

M man/drill_functions.Rd => man/drill_functions.Rd +1 -1
@@ 34,7 34,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_cancel}},
  \code{\link{drill_connection}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_metrics.Rd => man/drill_metrics.Rd +1 -1
@@ 22,7 22,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_cancel}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_options}},
  \code{\link{drill_options}}, \code{\link{drill_opts}},
  \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},

M man/drill_options.Rd => man/drill_options.Rd +1 -1
@@ 27,7 27,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_cancel}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}},
  \code{\link{drill_metrics}}, \code{\link{drill_opts}},
  \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},

A man/drill_opts.Rd => man/drill_opts.Rd +49 -0
@@ 0,0 1,49 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
\name{drill_opts}
\alias{drill_opts}
\title{Show all the available Drill options}
\usage{
drill_opts(drill_con, browse = FALSE)
}
\arguments{
\item{drill_con}{drill server connection object setup by \code{drill_connection()}}

\item{browse}{if \code{TRUE} display an HTML interacrtive HTML widget with the options
as well as reutrn the data frame with the options Default if \code{FALSE}.}
}
\value{
data frame
}
\description{
Show all the available Drill options
}
\note{
You \emph{must} be using Drill 1.15.0+ to use this function
}
\examples{
\dontrun{
drill_connection() \%>\% drill_opts()
}
}
\references{
\href{https://drill.apache.org/docs/querying-system-tables/#querying-the-options-table}{Drill documentation}
}
\seealso{
Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_cancel}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},
  \code{\link{drill_show_schemas}},
  \code{\link{drill_stats}}, \code{\link{drill_status}},
  \code{\link{drill_storage}},
  \code{\link{drill_system_reset}},
  \code{\link{drill_threads}}, \code{\link{drill_use}},
  \code{\link{drill_version}}
}
\concept{Dill direct REST API Interface}

M man/drill_profile.Rd => man/drill_profile.Rd +2 -1
@@ 23,7 23,8 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}}, \code{\link{drill_query}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},
  \code{\link{drill_show_schemas}},

M man/drill_profiles.Rd => man/drill_profiles.Rd +2 -1
@@ 26,7 26,8 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_opts}}, \code{\link{drill_profile}},
  \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},
  \code{\link{drill_show_schemas}},

M man/drill_query.Rd => man/drill_query.Rd +1 -1
@@ 41,7 41,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_set.Rd => man/drill_set.Rd +1 -1
@@ 39,7 39,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_show_files}},

M man/drill_settings_reset.Rd => man/drill_settings_reset.Rd +1 -1
@@ 28,7 28,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},
  \code{\link{drill_show_schemas}},

M man/drill_show_files.Rd => man/drill_show_files.Rd +1 -1
@@ 28,7 28,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}},

M man/drill_show_schemas.Rd => man/drill_show_schemas.Rd +1 -1
@@ 21,7 21,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_stats.Rd => man/drill_stats.Rd +1 -1
@@ 26,7 26,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_status.Rd => man/drill_status.Rd +1 -1
@@ 26,7 26,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_storage.Rd => man/drill_storage.Rd +3 -3
@@ 61,7 61,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},


@@ 76,7 76,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},


@@ 91,7 91,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_system_reset.Rd => man/drill_system_reset.Rd +1 -1
@@ 30,7 30,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_threads.Rd => man/drill_threads.Rd +1 -1
@@ 26,7 26,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_use.Rd => man/drill_use.Rd +1 -1
@@ 24,7 24,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},

M man/drill_version.Rd => man/drill_version.Rd +1 -1
@@ 26,7 26,7 @@ Other Dill direct REST API Interface: \code{\link{drill_active}},
  \code{\link{drill_connection}},
  \code{\link{drill_functions}},
  \code{\link{drill_metrics}}, \code{\link{drill_options}},
  \code{\link{drill_profiles}},
  \code{\link{drill_opts}}, \code{\link{drill_profiles}},
  \code{\link{drill_profile}}, \code{\link{drill_query}},
  \code{\link{drill_settings_reset}},
  \code{\link{drill_set}}, \code{\link{drill_show_files}},