Skip to content

Commit 6165ba3

Browse files
committed
Add R variants
1 parent 80ed5aa commit 6165ba3

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

R/pkg/NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ exportMethods("%<=>%",
202202
"%in%",
203203
"abs",
204204
"acos",
205+
"acosh",
205206
"add_months",
206207
"alias",
207208
"approx_count_distinct",
@@ -232,8 +233,10 @@ exportMethods("%<=>%",
232233
"asc_nulls_last",
233234
"ascii",
234235
"asin",
236+
"asinh",
235237
"assert_true",
236238
"atan",
239+
"atanh",
237240
"atan2",
238241
"avg",
239242
"base64",

R/pkg/R/functions.R

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,19 @@ setMethod("acos",
455455
column(jc)
456456
})
457457

458+
#' @details
459+
#' \code{acosh}: Computes inverse hyperbolic cosine of the input column.
460+
#'
461+
#' @rdname column_math_functions
462+
#' @aliases acosh acosh,Column-method
463+
#' @note acosh since 3.1.0
464+
setMethod("acosh",
465+
signature(x = "Column"),
466+
function(x) {
467+
jc <- callJStatic("org.apache.spark.sql.functions", "acosh", x@jc)
468+
column(jc)
469+
})
470+
458471
#' @details
459472
#' \code{approx_count_distinct}: Returns the approximate number of distinct items in a group.
460473
#'
@@ -522,6 +535,19 @@ setMethod("asin",
522535
column(jc)
523536
})
524537

538+
#' @details
539+
#' \code{asinh}: Computes inverse hyperbolic sine of the input column.
540+
#'
541+
#' @rdname column_math_functions
542+
#' @aliases asinh asinh,Column-method
543+
#' @note asinh since 3.1.0
544+
setMethod("asinh",
545+
signature(x = "Column"),
546+
function(x) {
547+
jc <- callJStatic("org.apache.spark.sql.functions", "asinh", x@jc)
548+
column(jc)
549+
})
550+
525551
#' @details
526552
#' \code{atan}: Returns the inverse tangent of the given value,
527553
#' as if computed by \code{java.lang.Math.atan()}
@@ -536,6 +562,19 @@ setMethod("atan",
536562
column(jc)
537563
})
538564

565+
#' @details
566+
#' \code{atanh}: Computes inverse hyperbolic tangent of the input column.
567+
#'
568+
#' @rdname column_math_functions
569+
#' @aliases atanh atanh,Column-method
570+
#' @note atanh since 3.1.0
571+
setMethod("atanh",
572+
signature(x = "Column"),
573+
function(x) {
574+
jc <- callJStatic("org.apache.spark.sql.functions", "atanh", x@jc)
575+
column(jc)
576+
})
577+
539578
#' avg
540579
#'
541580
#' Aggregate function: returns the average of the values in a group.

R/pkg/tests/fulltests/test_sparkSQL.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,7 @@ test_that("column functions", {
14301430
nth_value(column("v"), 3) + nth_value(column("z"), 4L, FALSE)
14311431
c28 <- asc_nulls_first(c1) + asc_nulls_last(c1) +
14321432
desc_nulls_first(c1) + desc_nulls_last(c1)
1433+
c29 <- acosh(c1) + asinh(c1) + atanh(c1)
14331434

14341435
# Test if base::is.nan() is exposed
14351436
expect_equal(is.nan(c("a", "b")), c(FALSE, FALSE))

0 commit comments

Comments
 (0)