Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ S3method(tail,RecordBatchReader)
S3method(tail,Scanner)
S3method(tail,arrow_dplyr_query)
S3method(type,ArrowDatum)
S3method(type,Expression)
S3method(type,default)
S3method(unique,ArrowDatum)
S3method(vec_ptype_abbr,arrow_fixed_size_binary)
Expand Down
3 changes: 3 additions & 0 deletions r/R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ type.default <- function(x) Array__infer_type(x)
#' @export
type.ArrowDatum <- function(x) x$type

#' @export
type.Expression <- function(x) x$type

#----- metadata

#' @title class arrow::FixedWidthType
Expand Down
10 changes: 10 additions & 0 deletions r/tests/testthat/test-type.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,13 @@ test_that("Type strings are correctly canonicalized", {
"Unrecognized"
)
})

test_that("type() gets the right type for Expression", {
x <- Expression$scalar(32L)
y <- Expression$scalar(10)
add_xy <- Expression$create("add", x, y)

expect_equal(x$type, type(x))
expect_equal(y$type, type(y))
expect_equal(add_xy$type, type(add_xy))
})