wjones127 commented on code in PR #12751:
URL: https://github.com/apache/arrow/pull/12751#discussion_r848613394
##########
r/R/record-batch.R:
##########
@@ -189,3 +189,61 @@ record_batch <- RecordBatch$create
#' @export
names.RecordBatch <- function(x) x$names()
+
+#' @export
+rbind.RecordBatch <- function(...) {
+ abort("Use `Table$create()` to combine record batches")
+}
+
+cbind_check_length <- function(target_length, length, idx) {
+ if (length != target_length) {
+ abort(
+ sprintf(
+ "Non-scalar inputs must have an equal number of rows. ..1 has %d, ..%d
has %d",
+ target_length,
+ idx,
+ length
+ )
+ )
+ }
+}
+
+#' @export
+cbind.RecordBatch <- function(..., call = caller_env()) {
+ inputs <- list(...)
+ num_rows <- inputs[[1]]$num_rows
+
+ batches <- map(seq_along(inputs), function(i) {
+ input <- inputs[[i]]
+ name <- names(inputs)[i]
+ name <- ifelse(name == "", paste0("X", as.character(i)), name)
Review Comment:
I ended up going with `base::make.names()`, which was simple enough to use.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]