Skip to content

Commit dbcd0d9

Browse files
thisisnicnealrichardson
authored andcommitted
ARROW-11705: [R] Support scalar value recycling in RecordBatch/Table$create()
This also adds missing spaces in some unrelated R files Closes apache#10269 from thisisnic/ARROW-11705_scalar_recycling Lead-authored-by: Nic Crane <thisisnic@gmail.com> Co-authored-by: Nic <thisisnic@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
1 parent 57ecc73 commit dbcd0d9

28 files changed

Lines changed: 226 additions & 60 deletions

r/R/arrow-datum.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ eval_array_expression <- function(FUN,
128128
}
129129

130130
#' @export
131-
na.omit.ArrowDatum <- function(object, ...){
131+
na.omit.ArrowDatum <- function(object, ...) {
132132
object$Filter(!is.na(object))
133133
}
134134

135135
#' @export
136136
na.exclude.ArrowDatum <- na.omit.ArrowDatum
137137

138138
#' @export
139-
na.fail.ArrowDatum <- function(object, ...){
139+
na.fail.ArrowDatum <- function(object, ...) {
140140
if (object$null_count > 0) {
141141
stop("missing values in object", call. = FALSE)
142142
}

r/R/arrow-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ ArrowObject <- R6Class("ArrowObject",
279279
class_title <- class(self)[[1]]
280280
}
281281
cat(class_title, "\n", sep = "")
282-
if (!is.null(self$ToString)){
282+
if (!is.null(self$ToString)) {
283283
cat(self$ToString(), "\n", sep = "")
284284
}
285285
invisible(self)

r/R/arrow-tabular.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ head.ArrowTabular <- head.ArrowDatum
212212
tail.ArrowTabular <- tail.ArrowDatum
213213

214214
#' @export
215-
na.fail.ArrowTabular <- function(object, ...){
215+
na.fail.ArrowTabular <- function(object, ...) {
216216
for (col in seq_len(object$num_columns)) {
217217
if (object$column(col - 1L)$null_count > 0) {
218218
stop("missing values in object", call. = FALSE)
@@ -222,7 +222,7 @@ na.fail.ArrowTabular <- function(object, ...){
222222
}
223223

224224
#' @export
225-
na.omit.ArrowTabular <- function(object, ...){
225+
na.omit.ArrowTabular <- function(object, ...) {
226226
not_na <- map(object$columns, ~call_function("is_valid", .x))
227227
not_na_agg <- Reduce("&", not_na)
228228
object$Filter(not_na_agg)

r/R/arrowExports.R

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/R/chunked-array.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ChunkedArray <- R6Class("ChunkedArray", inherit = ArrowDatum,
8383
type_id = function() ChunkedArray__type(self)$id,
8484
chunk = function(i) Array$create(ChunkedArray__chunk(self, i)),
8585
as_vector = function() ChunkedArray__as_vector(self),
86-
Slice = function(offset, length = NULL){
86+
Slice = function(offset, length = NULL) {
8787
if (is.null(length)) {
8888
ChunkedArray__Slice1(self, offset)
8989
} else {

r/R/compression.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ compression_from_name <- function(name) {
9999
#' @export
100100
#' @include arrow-package.R
101101
CompressedOutputStream <- R6Class("CompressedOutputStream", inherit = OutputStream)
102-
CompressedOutputStream$create <- function(stream, codec = "gzip", compression_level = NA){
102+
CompressedOutputStream$create <- function(stream, codec = "gzip", compression_level = NA) {
103103
codec <- Codec$create(codec, compression_level = compression_level)
104104
if (is.string(stream)) {
105105
stream <- FileOutputStream$create(stream)
@@ -113,7 +113,7 @@ CompressedOutputStream$create <- function(stream, codec = "gzip", compression_le
113113
#' @format NULL
114114
#' @export
115115
CompressedInputStream <- R6Class("CompressedInputStream", inherit = InputStream)
116-
CompressedInputStream$create <- function(stream, codec = "gzip", compression_level = NA){
116+
CompressedInputStream$create <- function(stream, codec = "gzip", compression_level = NA) {
117117
codec <- Codec$create(codec, compression_level = compression_level)
118118
if (is.string(stream)) {
119119
stream <- ReadableFile$create(stream)

r/R/compute.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ unique.ArrowDatum <- function(x, incomparables = FALSE, ...) {
202202
}
203203

204204
#' @export
205-
any.ArrowDatum <- function(..., na.rm = FALSE){
205+
any.ArrowDatum <- function(..., na.rm = FALSE) {
206206

207207
a <- collect_arrays_from_dots(list(...))
208208
result <- call_function("any", a)
@@ -217,7 +217,7 @@ any.ArrowDatum <- function(..., na.rm = FALSE){
217217
}
218218

219219
#' @export
220-
all.ArrowDatum <- function(..., na.rm = FALSE){
220+
all.ArrowDatum <- function(..., na.rm = FALSE) {
221221

222222
a <- collect_arrays_from_dots(list(...))
223223
result <- call_function("all", a)

r/R/csv.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ CsvReadOptions$create <- function(use_threads = option_use_threads(),
414414
#' @rdname CsvReadOptions
415415
#' @export
416416
CsvWriteOptions <- R6Class("CsvWriteOptions", inherit = ArrowObject)
417-
CsvWriteOptions$create <- function(include_header = TRUE, batch_size = 1024L){
417+
CsvWriteOptions$create <- function(include_header = TRUE, batch_size = 1024L) {
418418
assert_that(is_integerish(batch_size, n = 1, finite = TRUE), batch_size > 0)
419419
csv___WriteOptions__initialize(
420420
list(
@@ -637,9 +637,9 @@ write_csv_arrow <- function(x,
637637
on.exit(sink$close())
638638
}
639639

640-
if(inherits(x, "RecordBatch")){
640+
if (inherits(x, "RecordBatch")) {
641641
csv___WriteCSV__RecordBatch(x, write_options, sink)
642-
} else if(inherits(x, "Table")){
642+
} else if (inherits(x, "Table")) {
643643
csv___WriteCSV__Table(x, write_options, sink)
644644
}
645645

r/R/enums.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
# under the License.
1717

1818
#' @export
19-
`print.arrow-enum` <- function(x, ...){
19+
`print.arrow-enum` <- function(x, ...) {
2020
NextMethod()
2121
}
2222

23-
enum <- function(class, ..., .list = list(...)){
23+
enum <- function(class, ..., .list = list(...)) {
2424
structure(
2525
.list,
2626
class = c(class, "arrow-enum")

r/R/filesystem.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ FileSystem <- R6Class("FileSystem", inherit = ArrowObject,
203203
GetFileInfo = function(x) {
204204
if (inherits(x, "FileSelector")) {
205205
fs___FileSystem__GetTargetInfos_FileSelector(self, x)
206-
} else if (is.character(x)){
206+
} else if (is.character(x)) {
207207
fs___FileSystem__GetTargetInfos_Paths(self, clean_path_rel(x))
208208
} else {
209209
abort("incompatible type for FileSystem$GetFileInfo()")

0 commit comments

Comments
 (0)