wjones127 commented on code in PR #12751:
URL: https://github.com/apache/arrow/pull/12751#discussion_r855532669
##########
r/R/table.R:
##########
@@ -149,6 +149,83 @@ Table$create <- function(..., schema = NULL) {
#' @export
names.Table <- function(x) x$ColumnNames()
+#' Concatenate one or more Tables
+#'
+#' Concatenate one or more [Table] objects into a single table. This operation
+#' does not copy array data, but instead creates new chunked arrays for each
+#' column that point at existing array data.
+#'
+#' @param ... A [Table]
+#' @param unify_schemas If TRUE, the schemas of the tables will be first
unified
+#' with fields of the same name being merged, then each table will be promoted
+#' to the unified schema before being concatenated. Otherwise, all tables
should
+#' have the same schema.
+#' @examplesIf arrow_available()
+#' tbl <- arrow_table(name = rownames(mtcars), mtcars)
+#' prius <- arrow_table(name = "Prius", mpg = 58, cyl = 4, disp = 1.8)
+#' combined <- concat_tables(tbl, prius)
+#' tail(combined)$to_data_frame()
+#' @export
+concat_tables <- function(..., unify_schemas = TRUE) {
+ tables <- list2(...)
+
+ if (!unify_schemas) {
+ # assert they have same schema
Review Comment:
It feels silly to reimplement error handling, but also suboptimal to have
the error provide indexes that are "wrong" (in context). For now I've pushed up
a fix that includes the errors. But we could also just delete the error
handling and just use the C++ handling.
--
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]