~hrbrmstr/sergeant

4dea204ba047b6e9c9f85427752018cc1b6c8b58 — boB Rudis 2 years ago cd71c1a
set markdown for roxygen package-wide in DESCRIPTION
M DESCRIPTION => DESCRIPTION +1 -0
@@ 39,3 39,4 @@ Suggests:
    testthat (>= 1.0.2),
    covr (>= 3.0.0)
RoxygenNote: 6.1.1
Roxygen: list(markdown = TRUE)

M NAMESPACE => NAMESPACE +1 -0
@@ 48,6 48,7 @@ exportMethods(dbConnect)
exportMethods(dbDataType)
exportMethods(dbDisconnect)
exportMethods(dbFetch)
exportMethods(dbGetInfo)
exportMethods(dbGetStatement)
exportMethods(dbHasCompleted)
exportMethods(dbIsValid)

M R/dbi.r => R/dbi.r +29 -0
@@ 416,3 416,32 @@ setMethod(
  'DrillResult',
  function(res, ...) { return(res@statement) }
)


#' Metadata about database objects
#' @rdname dbGetInfo
#' @param dbObj A \code{\linkS4class{DrillDriver}} or \code{\linkS4class{DrillConnection}} object
#' @export
setMethod(
  "dbGetInfo",
  "DrillDriver",
  function(dbObj) {
    return()
  }
)

#' @rdname dbGetInfo
#' @export
setMethod(
  "dbGetInfo",
  "DrillConnection",
  function(dbObj) {
    return(list(
      host = dbObj@host,
      port = dbObj@port,
      user = dbObj@username,
      ssl = dbObj@ssl,
      implicits = dbObj@implicits
    ))
  }
)

M R/dplyr.r => R/dplyr.r +4 -4
@@ 1,13 1,13 @@
#' Connect to Drill (dplyr)
#'
#' Use \code{src_drill()} to connect to a Drill cluster and `tbl()` to connect to a
#' Use `src_drill()` to connect to a Drill cluster and `tbl()` to connect to a
#' fully-qualified "table reference". The vast majority of Drill SQL functions have
#' also been made available to the \code{dplyr} interface. If you have custom Drill
#' also been made available to the `dplyr` interface. If you have custom Drill
#' SQL functions that need to be implemented please file an issue on GitHub.
#'
#' @md
#' @param host Drill host (will pick up the value from \code{DRILL_HOST} env var)
#' @param port Drill port (will pick up the value from \code{DRILL_PORT} env var)
#' @param host Drill host (will pick up the value from `DRILL_HOST` env var)
#' @param port Drill port (will pick up the value from `DRILL_PORT` env var)
#' @param ssl use ssl?
#' @family Drill REST `dplyr` API
#' @param username,password if not `NULL` the credentials for the Drill service.

R R/sergeant.r => R/rest-api.r +0 -0
M R/set.R => R/set.R +1 -1
@@ 7,7 7,7 @@
#' If any query errors result, error messages will be presented to the console.
#'
#' @param drill_con drill server connection object setup by \code{drill_connection()}
#' @param ... named parameters to be sent to ALTER [SYSTEM|SESSION]
#' @param ... named parameters to be sent to `ALTER SYSTEM` or `ALTER SESSION`
#' @param type set the \code{session} or \code{system} parameter
#' @return a \code{tbl} (invisibly) with the \code{ALTER} queries sent and results, including errors.
#' @references \href{https://drill.apache.org/docs/}{Drill documentation}

A man/dbGetInfo.Rd => man/dbGetInfo.Rd +18 -0
@@ 0,0 1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dbi.r
\docType{methods}
\name{dbGetInfo,DrillDriver-method}
\alias{dbGetInfo,DrillDriver-method}
\alias{dbGetInfo,DrillConnection-method}
\title{Metadata about database objects}
\usage{
\S4method{dbGetInfo}{DrillDriver}(dbObj)

\S4method{dbGetInfo}{DrillConnection}(dbObj)
}
\arguments{
\item{dbObj}{A \code{\linkS4class{DrillDriver}} or \code{\linkS4class{DrillConnection}} object}
}
\description{
Metadata about database objects
}

M man/drill_active.Rd => man/drill_active.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_active}
\alias{drill_active}
\title{Test whether Drill HTTP Drill direct REST API Interface server is up}

M man/drill_cancel.Rd => man/drill_cancel.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_cancel}
\alias{drill_cancel}
\title{Cancel the query that has the given queryid}

M man/drill_connection.Rd => man/drill_connection.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_connection}
\alias{drill_connection}
\title{Setup a Drill connection}

M man/drill_functions.Rd => man/drill_functions.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_functions}
\alias{drill_functions}
\title{Show all the available Drill built-in functions & UDFs}

M man/drill_metrics.Rd => man/drill_metrics.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_metrics}
\alias{drill_metrics}
\title{Get the current memory metrics}

M man/drill_options.Rd => man/drill_options.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_options}
\alias{drill_options}
\title{List the name, default, and data type of the system and session options}

M man/drill_opts.Rd => man/drill_opts.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_opts}
\alias{drill_opts}
\title{Show all the available Drill options}

M man/drill_profile.Rd => man/drill_profile.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_profile}
\alias{drill_profile}
\title{Get the profile of the query that has the given queryid}

M man/drill_profiles.Rd => man/drill_profiles.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_profiles}
\alias{drill_profiles}
\title{Get the profiles of running and completed queries}

M man/drill_query.Rd => man/drill_query.Rd +1 -1
@@ 22,7 22,7 @@ ignored if \code{drill_con} is a \code{JDBCConnection} created by
\description{
This function can handle REST API connections or JDBC connections. There is a benefit to
calling this function for JDBC connections vs a straight call to \code{dbGetQuery()} in
that the function result is a `tbl_df` vs a plain \code{data.frame} so you get better
that the function result is a \code{tbl_df} vs a plain \code{data.frame} so you get better
default printing (which can be helpful if you accidentally execute a query and the result
set is huge).
}

M man/drill_set.Rd => man/drill_set.Rd +1 -1
@@ 9,7 9,7 @@ drill_set(drill_con, ..., type = c("session", "system"))
\arguments{
\item{drill_con}{drill server connection object setup by \code{drill_connection()}}

\item{...}{named parameters to be sent to ALTER [SYSTEM|SESSION]}
\item{...}{named parameters to be sent to \code{ALTER SYSTEM} or \code{ALTER SESSION}}

\item{type}{set the \code{session} or \code{system} parameter}
}

M man/drill_stats.Rd => man/drill_stats.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_stats}
\alias{drill_stats}
\title{Get Drillbit information, such as ports numbers}

M man/drill_status.Rd => man/drill_status.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_status}
\alias{drill_status}
\title{Get the status of Drill}

M man/drill_storage.Rd => man/drill_storage.Rd +5 -5
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_storage}
\alias{drill_storage}
\alias{drill_mod_storage}


@@ 17,9 17,9 @@ drill_rm_storage(drill_con, name)

\item{plugin}{the assigned name in the storage plugin definition.}

\item{as}{one of "`tbl`" or "`list`" or "`raw`". The latter two are useful if you want
\item{as}{one of "\code{tbl}" or "\code{list}" or "\code{raw}". The latter two are useful if you want
modify an existing storage plugin (e.g. add a workspace) via
[drill_mod_storage()].}
\code{\link[=drill_mod_storage]{drill_mod_storage()}}.}

\item{name}{name of the storage plugin configuration to create/update/remove}



@@ 28,8 28,8 @@ complete storage spec}
}
\description{
Retrieve, modify or remove storage plugins from a Drill instance. If you intend
to modify an existing configuration it is suggested that you use the "`list`" or
"`raw`" values to the `as` parameter to make it easier to modify them.
to modify an existing configuration it is suggested that you use the "\code{list}" or
"\code{raw}" values to the \code{as} parameter to make it easier to modify them.
}
\examples{
\dontrun{

M man/drill_threads.Rd => man/drill_threads.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_threads}
\alias{drill_threads}
\title{Get information about threads}

M man/drill_uplift.Rd => man/drill_uplift.Rd +4 -4
@@ 7,16 7,16 @@
drill_uplift(query_result)
}
\arguments{
\item{query_result}{the result of a call to `drill_query()`}
\item{query_result}{the result of a call to \code{drill_query()}}
}
\description{
If you know the result of `drill_query()` will be a data frame, then
you can pipe it to this function to pull out `rows` and automatically
If you know the result of \code{drill_query()} will be a data frame, then
you can pipe it to this function to pull out \code{rows} and automatically
type-convert it.
}
\details{
Not really intended to be called directly, but useful if you accidentally ran
\code{drill_query()} without `uplift=TRUE` but want to then convert the structure.
\code{drill_query()} without \code{uplift=TRUE} but want to then convert the structure.
}
\references{
\href{https://drill.apache.org/docs/}{Drill documentation}

M man/drill_version.Rd => man/drill_version.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{drill_version}
\alias{drill_version}
\title{Identify the version of Drill running}

M man/print.drill_conn.Rd => man/print.drill_conn.Rd +1 -1
@@ 1,5 1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sergeant.r
% Please edit documentation in R/rest-api.r
\name{print.drill_conn}
\alias{print.drill_conn}
\title{Print function for \code{drill_conn} objects}

M man/sergeant.Rd => man/sergeant.Rd +4 -4
@@ 13,10 13,10 @@ having to create and manage schemas. Some of the key features are:
}
\details{
\itemize{
  \item{Schema-free JSON document model similar to MongoDB and Elasticsearch}
  \item{Industry-standard APIs: ANSI SQL, ODBC/JDBC, RESTful APIs}
  \item{Extremely user and developer friendly}
  \item{Pluggable architecture enables connectivity to multiple datastores}
\item{Schema-free JSON document model similar to MongoDB and Elasticsearch}
\item{Industry-standard APIs: ANSI SQL, ODBC/JDBC, RESTful APIs}
\item{Extremely user and developer friendly}
\item{Pluggable architecture enables connectivity to multiple datastores}
}

Drill includes a distributed execution environment, purpose built for large-scale data

M tests/testthat/test-sergeant.R => tests/testthat/test-sergeant.R +5 -0
@@ 82,6 82,11 @@ test_that("core DBI ops work", {
  expect_equal(dbDataType(con, bit64::integer64(0)), "BIGINT")
  expect_equal(dbDataType(con, numeric(0)), "DOUBLE")

  expect_true(is.null(dbGetInfo(Drill())))

  inf <- dbGetInfo(con)
  expect_equal(inf$port, 8047)

})

context("REST API")