Skip to content

Commit a89a9a8

Browse files
Move RecordBatch impl to own file
1 parent a2f9f51 commit a89a9a8

File tree

6 files changed

+233
-207
lines changed

6 files changed

+233
-207
lines changed

r/R/RcppExports.R

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
22
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
33

4+
RecordBatch__num_columns <- function(x) {
5+
.Call(`_arrow_RecordBatch__num_columns`, x)
6+
}
7+
8+
RecordBatch__num_rows <- function(x) {
9+
.Call(`_arrow_RecordBatch__num_rows`, x)
10+
}
11+
12+
RecordBatch__schema <- function(x) {
13+
.Call(`_arrow_RecordBatch__schema`, x)
14+
}
15+
16+
RecordBatch__column <- function(batch, i) {
17+
.Call(`_arrow_RecordBatch__column`, batch, i)
18+
}
19+
20+
RecordBatch_to_dataframe <- function(batch) {
21+
.Call(`_arrow_RecordBatch_to_dataframe`, batch)
22+
}
23+
24+
read_record_batch_ <- function(path) {
25+
.Call(`_arrow_read_record_batch_`, path)
26+
}
27+
28+
RecordBatch_to_file <- function(batch, path) {
29+
.Call(`_arrow_RecordBatch_to_file`, batch, path)
30+
}
31+
432
ArrayData_get_type <- function(x) {
533
.Call(`_arrow_ArrayData_get_type`, x)
634
}
@@ -61,32 +89,16 @@ Array_data <- function(array) {
6189
.Call(`_arrow_Array_data`, array)
6290
}
6391

64-
rvector_to_Array <- function(x) {
65-
.Call(`_arrow_rvector_to_Array`, x)
92+
Array__from_vector <- function(x) {
93+
.Call(`_arrow_Array__from_vector`, x)
6694
}
6795

6896
dataframe_to_RecordBatch <- function(tbl) {
6997
.Call(`_arrow_dataframe_to_RecordBatch`, tbl)
7098
}
7199

72-
RecordBatch_num_columns <- function(x) {
73-
.Call(`_arrow_RecordBatch_num_columns`, x)
74-
}
75-
76-
RecordBatch_num_rows <- function(x) {
77-
.Call(`_arrow_RecordBatch_num_rows`, x)
78-
}
79-
80-
RecordBatch_schema <- function(x) {
81-
.Call(`_arrow_RecordBatch_schema`, x)
82-
}
83-
84-
RecordBatch_column <- function(batch, i) {
85-
.Call(`_arrow_RecordBatch_column`, batch, i)
86-
}
87-
88-
Array_as_vector <- function(array) {
89-
.Call(`_arrow_Array_as_vector`, array)
100+
Array__as_vector <- function(array) {
101+
.Call(`_arrow_Array__as_vector`, array)
90102
}
91103

92104
Array__Slice1 <- function(array, offset) {
@@ -137,10 +149,6 @@ ChunkedArray__Make <- function(chunks) {
137149
.Call(`_arrow_ChunkedArray__Make`, chunks)
138150
}
139151

140-
RecordBatch_to_dataframe <- function(batch) {
141-
.Call(`_arrow_RecordBatch_to_dataframe`, batch)
142-
}
143-
144152
dataframe_to_Table <- function(tbl) {
145153
.Call(`_arrow_dataframe_to_Table`, tbl)
146154
}
@@ -157,14 +165,6 @@ Table_schema <- function(x) {
157165
.Call(`_arrow_Table_schema`, x)
158166
}
159167

160-
RecordBatch_to_file <- function(batch, path) {
161-
.Call(`_arrow_RecordBatch_to_file`, batch, path)
162-
}
163-
164-
read_record_batch_ <- function(path) {
165-
.Call(`_arrow_read_record_batch_`, path)
166-
}
167-
168168
Table_to_file <- function(table, path) {
169169
.Call(`_arrow_Table_to_file`, table, path)
170170
}

r/R/array.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
Equals = function(other) Array_Equals(self, other),
4141
ApproxEquals = function(othet) Array_ApproxEquals(self, other),
4242
data = function() `arrow::ArrayData`$new(Array_data(self)),
43-
as_vector = function() Array_as_vector(self),
43+
as_vector = function() Array__as_vector(self),
4444
ToString = function() Array_ToString(self),
4545
Slice = function(offset, length = NULL){
4646
if (is.null(length)) {
@@ -67,22 +67,22 @@
6767
#'
6868
#' @export
6969
array <- function(...){
70-
`arrow::Array`$new(rvector_to_Array(vctrs::vec_c(...)))
70+
`arrow::Array`$new(Array__from_vector(vctrs::vec_c(...)))
7171
}
7272

7373
`arrow::RecordBatch` <- R6Class("arrow::RecordBatch", inherit = `arrow::Object`,
7474
public = list(
75-
num_columns = function() RecordBatch_num_columns(self),
76-
num_rows = function() RecordBatch_num_rows(self),
77-
schema = function() `arrow::Schema`$new(RecordBatch_schema(self)),
78-
to_file = function(path) invisible(RecordBatch_to_file(self, fs::path_abs(path))),
79-
column = function(i) `arrow::Array`$new(RecordBatch_column(self, i))
75+
num_columns = function() RecordBatch__num_columns(self),
76+
num_rows = function() RecordBatch__num_rows(self),
77+
schema = function() `arrow::Schema`$new(RecordBatch__schema(self)),
78+
to_file = function(path) invisible(RecordBatch__to_file(self, fs::path_abs(path))),
79+
column = function(i) `arrow::Array`$new(RecordBatch__column(self, i))
8080
)
8181
)
8282

8383
#' @export
8484
`as_tibble.arrow::RecordBatch` <- function(x, ...){
85-
RecordBatch_to_dataframe(x)
85+
RecordBatch__to_dataframe(x)
8686
}
8787

8888
#' Create an arrow::RecordBatch from a data frame

r/src/RcppExports.cpp

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,85 @@
66

77
using namespace Rcpp;
88

9+
// RecordBatch__num_columns
10+
int RecordBatch__num_columns(const std::shared_ptr<arrow::RecordBatch>& x);
11+
RcppExport SEXP _arrow_RecordBatch__num_columns(SEXP xSEXP) {
12+
BEGIN_RCPP
13+
Rcpp::RObject rcpp_result_gen;
14+
Rcpp::RNGScope rcpp_rngScope_gen;
15+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
16+
rcpp_result_gen = Rcpp::wrap(RecordBatch__num_columns(x));
17+
return rcpp_result_gen;
18+
END_RCPP
19+
}
20+
// RecordBatch__num_rows
21+
int RecordBatch__num_rows(const std::shared_ptr<arrow::RecordBatch>& x);
22+
RcppExport SEXP _arrow_RecordBatch__num_rows(SEXP xSEXP) {
23+
BEGIN_RCPP
24+
Rcpp::RObject rcpp_result_gen;
25+
Rcpp::RNGScope rcpp_rngScope_gen;
26+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
27+
rcpp_result_gen = Rcpp::wrap(RecordBatch__num_rows(x));
28+
return rcpp_result_gen;
29+
END_RCPP
30+
}
31+
// RecordBatch__schema
32+
std::shared_ptr<arrow::Schema> RecordBatch__schema(const std::shared_ptr<arrow::RecordBatch>& x);
33+
RcppExport SEXP _arrow_RecordBatch__schema(SEXP xSEXP) {
34+
BEGIN_RCPP
35+
Rcpp::RObject rcpp_result_gen;
36+
Rcpp::RNGScope rcpp_rngScope_gen;
37+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
38+
rcpp_result_gen = Rcpp::wrap(RecordBatch__schema(x));
39+
return rcpp_result_gen;
40+
END_RCPP
41+
}
42+
// RecordBatch__column
43+
std::shared_ptr<arrow::Array> RecordBatch__column(const std::shared_ptr<arrow::RecordBatch>& batch, int i);
44+
RcppExport SEXP _arrow_RecordBatch__column(SEXP batchSEXP, SEXP iSEXP) {
45+
BEGIN_RCPP
46+
Rcpp::RObject rcpp_result_gen;
47+
Rcpp::RNGScope rcpp_rngScope_gen;
48+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
49+
Rcpp::traits::input_parameter< int >::type i(iSEXP);
50+
rcpp_result_gen = Rcpp::wrap(RecordBatch__column(batch, i));
51+
return rcpp_result_gen;
52+
END_RCPP
53+
}
54+
// RecordBatch_to_dataframe
55+
List RecordBatch_to_dataframe(const std::shared_ptr<arrow::RecordBatch>& batch);
56+
RcppExport SEXP _arrow_RecordBatch_to_dataframe(SEXP batchSEXP) {
57+
BEGIN_RCPP
58+
Rcpp::RObject rcpp_result_gen;
59+
Rcpp::RNGScope rcpp_rngScope_gen;
60+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
61+
rcpp_result_gen = Rcpp::wrap(RecordBatch_to_dataframe(batch));
62+
return rcpp_result_gen;
63+
END_RCPP
64+
}
65+
// read_record_batch_
66+
std::shared_ptr<arrow::RecordBatch> read_record_batch_(std::string path);
67+
RcppExport SEXP _arrow_read_record_batch_(SEXP pathSEXP) {
68+
BEGIN_RCPP
69+
Rcpp::RObject rcpp_result_gen;
70+
Rcpp::RNGScope rcpp_rngScope_gen;
71+
Rcpp::traits::input_parameter< std::string >::type path(pathSEXP);
72+
rcpp_result_gen = Rcpp::wrap(read_record_batch_(path));
73+
return rcpp_result_gen;
74+
END_RCPP
75+
}
76+
// RecordBatch_to_file
77+
int RecordBatch_to_file(const std::shared_ptr<arrow::RecordBatch>& batch, std::string path);
78+
RcppExport SEXP _arrow_RecordBatch_to_file(SEXP batchSEXP, SEXP pathSEXP) {
79+
BEGIN_RCPP
80+
Rcpp::RObject rcpp_result_gen;
81+
Rcpp::RNGScope rcpp_rngScope_gen;
82+
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
83+
Rcpp::traits::input_parameter< std::string >::type path(pathSEXP);
84+
rcpp_result_gen = Rcpp::wrap(RecordBatch_to_file(batch, path));
85+
return rcpp_result_gen;
86+
END_RCPP
87+
}
988
// ArrayData_get_type
1089
std::shared_ptr<arrow::DataType> ArrayData_get_type(const std::shared_ptr<arrow::ArrayData>& x);
1190
RcppExport SEXP _arrow_ArrayData_get_type(SEXP xSEXP) {
@@ -175,14 +254,14 @@ BEGIN_RCPP
175254
return rcpp_result_gen;
176255
END_RCPP
177256
}
178-
// rvector_to_Array
179-
std::shared_ptr<arrow::Array> rvector_to_Array(SEXP x);
180-
RcppExport SEXP _arrow_rvector_to_Array(SEXP xSEXP) {
257+
// Array__from_vector
258+
std::shared_ptr<arrow::Array> Array__from_vector(SEXP x);
259+
RcppExport SEXP _arrow_Array__from_vector(SEXP xSEXP) {
181260
BEGIN_RCPP
182261
Rcpp::RObject rcpp_result_gen;
183262
Rcpp::RNGScope rcpp_rngScope_gen;
184263
Rcpp::traits::input_parameter< SEXP >::type x(xSEXP);
185-
rcpp_result_gen = Rcpp::wrap(rvector_to_Array(x));
264+
rcpp_result_gen = Rcpp::wrap(Array__from_vector(x));
186265
return rcpp_result_gen;
187266
END_RCPP
188267
}
@@ -197,59 +276,14 @@ BEGIN_RCPP
197276
return rcpp_result_gen;
198277
END_RCPP
199278
}
200-
// RecordBatch_num_columns
201-
int RecordBatch_num_columns(const std::shared_ptr<arrow::RecordBatch>& x);
202-
RcppExport SEXP _arrow_RecordBatch_num_columns(SEXP xSEXP) {
203-
BEGIN_RCPP
204-
Rcpp::RObject rcpp_result_gen;
205-
Rcpp::RNGScope rcpp_rngScope_gen;
206-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
207-
rcpp_result_gen = Rcpp::wrap(RecordBatch_num_columns(x));
208-
return rcpp_result_gen;
209-
END_RCPP
210-
}
211-
// RecordBatch_num_rows
212-
int RecordBatch_num_rows(const std::shared_ptr<arrow::RecordBatch>& x);
213-
RcppExport SEXP _arrow_RecordBatch_num_rows(SEXP xSEXP) {
214-
BEGIN_RCPP
215-
Rcpp::RObject rcpp_result_gen;
216-
Rcpp::RNGScope rcpp_rngScope_gen;
217-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
218-
rcpp_result_gen = Rcpp::wrap(RecordBatch_num_rows(x));
219-
return rcpp_result_gen;
220-
END_RCPP
221-
}
222-
// RecordBatch_schema
223-
std::shared_ptr<arrow::Schema> RecordBatch_schema(const std::shared_ptr<arrow::RecordBatch>& x);
224-
RcppExport SEXP _arrow_RecordBatch_schema(SEXP xSEXP) {
225-
BEGIN_RCPP
226-
Rcpp::RObject rcpp_result_gen;
227-
Rcpp::RNGScope rcpp_rngScope_gen;
228-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type x(xSEXP);
229-
rcpp_result_gen = Rcpp::wrap(RecordBatch_schema(x));
230-
return rcpp_result_gen;
231-
END_RCPP
232-
}
233-
// RecordBatch_column
234-
std::shared_ptr<arrow::Array> RecordBatch_column(const std::shared_ptr<arrow::RecordBatch>& batch, int i);
235-
RcppExport SEXP _arrow_RecordBatch_column(SEXP batchSEXP, SEXP iSEXP) {
236-
BEGIN_RCPP
237-
Rcpp::RObject rcpp_result_gen;
238-
Rcpp::RNGScope rcpp_rngScope_gen;
239-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
240-
Rcpp::traits::input_parameter< int >::type i(iSEXP);
241-
rcpp_result_gen = Rcpp::wrap(RecordBatch_column(batch, i));
242-
return rcpp_result_gen;
243-
END_RCPP
244-
}
245-
// Array_as_vector
246-
SEXP Array_as_vector(const std::shared_ptr<arrow::Array>& array);
247-
RcppExport SEXP _arrow_Array_as_vector(SEXP arraySEXP) {
279+
// Array__as_vector
280+
SEXP Array__as_vector(const std::shared_ptr<arrow::Array>& array);
281+
RcppExport SEXP _arrow_Array__as_vector(SEXP arraySEXP) {
248282
BEGIN_RCPP
249283
Rcpp::RObject rcpp_result_gen;
250284
Rcpp::RNGScope rcpp_rngScope_gen;
251285
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::Array>& >::type array(arraySEXP);
252-
rcpp_result_gen = Rcpp::wrap(Array_as_vector(array));
286+
rcpp_result_gen = Rcpp::wrap(Array__as_vector(array));
253287
return rcpp_result_gen;
254288
END_RCPP
255289
}
@@ -392,17 +426,6 @@ BEGIN_RCPP
392426
return rcpp_result_gen;
393427
END_RCPP
394428
}
395-
// RecordBatch_to_dataframe
396-
List RecordBatch_to_dataframe(const std::shared_ptr<arrow::RecordBatch>& batch);
397-
RcppExport SEXP _arrow_RecordBatch_to_dataframe(SEXP batchSEXP) {
398-
BEGIN_RCPP
399-
Rcpp::RObject rcpp_result_gen;
400-
Rcpp::RNGScope rcpp_rngScope_gen;
401-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
402-
rcpp_result_gen = Rcpp::wrap(RecordBatch_to_dataframe(batch));
403-
return rcpp_result_gen;
404-
END_RCPP
405-
}
406429
// dataframe_to_Table
407430
std::shared_ptr<arrow::Table> dataframe_to_Table(DataFrame tbl);
408431
RcppExport SEXP _arrow_dataframe_to_Table(SEXP tblSEXP) {
@@ -447,29 +470,6 @@ BEGIN_RCPP
447470
return rcpp_result_gen;
448471
END_RCPP
449472
}
450-
// RecordBatch_to_file
451-
int RecordBatch_to_file(const std::shared_ptr<arrow::RecordBatch>& batch, std::string path);
452-
RcppExport SEXP _arrow_RecordBatch_to_file(SEXP batchSEXP, SEXP pathSEXP) {
453-
BEGIN_RCPP
454-
Rcpp::RObject rcpp_result_gen;
455-
Rcpp::RNGScope rcpp_rngScope_gen;
456-
Rcpp::traits::input_parameter< const std::shared_ptr<arrow::RecordBatch>& >::type batch(batchSEXP);
457-
Rcpp::traits::input_parameter< std::string >::type path(pathSEXP);
458-
rcpp_result_gen = Rcpp::wrap(RecordBatch_to_file(batch, path));
459-
return rcpp_result_gen;
460-
END_RCPP
461-
}
462-
// read_record_batch_
463-
std::shared_ptr<arrow::RecordBatch> read_record_batch_(std::string path);
464-
RcppExport SEXP _arrow_read_record_batch_(SEXP pathSEXP) {
465-
BEGIN_RCPP
466-
Rcpp::RObject rcpp_result_gen;
467-
Rcpp::RNGScope rcpp_rngScope_gen;
468-
Rcpp::traits::input_parameter< std::string >::type path(pathSEXP);
469-
rcpp_result_gen = Rcpp::wrap(read_record_batch_(path));
470-
return rcpp_result_gen;
471-
END_RCPP
472-
}
473473
// Table_to_file
474474
int Table_to_file(const std::shared_ptr<arrow::Table>& table, std::string path);
475475
RcppExport SEXP _arrow_Table_to_file(SEXP tableSEXP, SEXP pathSEXP) {
@@ -1122,6 +1122,13 @@ END_RCPP
11221122
}
11231123

11241124
static const R_CallMethodDef CallEntries[] = {
1125+
{"_arrow_RecordBatch__num_columns", (DL_FUNC) &_arrow_RecordBatch__num_columns, 1},
1126+
{"_arrow_RecordBatch__num_rows", (DL_FUNC) &_arrow_RecordBatch__num_rows, 1},
1127+
{"_arrow_RecordBatch__schema", (DL_FUNC) &_arrow_RecordBatch__schema, 1},
1128+
{"_arrow_RecordBatch__column", (DL_FUNC) &_arrow_RecordBatch__column, 2},
1129+
{"_arrow_RecordBatch_to_dataframe", (DL_FUNC) &_arrow_RecordBatch_to_dataframe, 1},
1130+
{"_arrow_read_record_batch_", (DL_FUNC) &_arrow_read_record_batch_, 1},
1131+
{"_arrow_RecordBatch_to_file", (DL_FUNC) &_arrow_RecordBatch_to_file, 2},
11251132
{"_arrow_ArrayData_get_type", (DL_FUNC) &_arrow_ArrayData_get_type, 1},
11261133
{"_arrow_ArrayData_get_length", (DL_FUNC) &_arrow_ArrayData_get_length, 1},
11271134
{"_arrow_ArrayData_get_null_count", (DL_FUNC) &_arrow_ArrayData_get_null_count, 1},
@@ -1137,13 +1144,9 @@ static const R_CallMethodDef CallEntries[] = {
11371144
{"_arrow_Array_Equals", (DL_FUNC) &_arrow_Array_Equals, 2},
11381145
{"_arrow_Array_ApproxEquals", (DL_FUNC) &_arrow_Array_ApproxEquals, 2},
11391146
{"_arrow_Array_data", (DL_FUNC) &_arrow_Array_data, 1},
1140-
{"_arrow_rvector_to_Array", (DL_FUNC) &_arrow_rvector_to_Array, 1},
1147+
{"_arrow_Array__from_vector", (DL_FUNC) &_arrow_Array__from_vector, 1},
11411148
{"_arrow_dataframe_to_RecordBatch", (DL_FUNC) &_arrow_dataframe_to_RecordBatch, 1},
1142-
{"_arrow_RecordBatch_num_columns", (DL_FUNC) &_arrow_RecordBatch_num_columns, 1},
1143-
{"_arrow_RecordBatch_num_rows", (DL_FUNC) &_arrow_RecordBatch_num_rows, 1},
1144-
{"_arrow_RecordBatch_schema", (DL_FUNC) &_arrow_RecordBatch_schema, 1},
1145-
{"_arrow_RecordBatch_column", (DL_FUNC) &_arrow_RecordBatch_column, 2},
1146-
{"_arrow_Array_as_vector", (DL_FUNC) &_arrow_Array_as_vector, 1},
1149+
{"_arrow_Array__as_vector", (DL_FUNC) &_arrow_Array__as_vector, 1},
11471150
{"_arrow_Array__Slice1", (DL_FUNC) &_arrow_Array__Slice1, 2},
11481151
{"_arrow_Array__Slice2", (DL_FUNC) &_arrow_Array__Slice2, 3},
11491152
{"_arrow_ChunkedArray__length", (DL_FUNC) &_arrow_ChunkedArray__length, 1},
@@ -1156,13 +1159,10 @@ static const R_CallMethodDef CallEntries[] = {
11561159
{"_arrow_ChunkArray__Slice1", (DL_FUNC) &_arrow_ChunkArray__Slice1, 2},
11571160
{"_arrow_ChunkArray__Slice2", (DL_FUNC) &_arrow_ChunkArray__Slice2, 3},
11581161
{"_arrow_ChunkedArray__Make", (DL_FUNC) &_arrow_ChunkedArray__Make, 1},
1159-
{"_arrow_RecordBatch_to_dataframe", (DL_FUNC) &_arrow_RecordBatch_to_dataframe, 1},
11601162
{"_arrow_dataframe_to_Table", (DL_FUNC) &_arrow_dataframe_to_Table, 1},
11611163
{"_arrow_Table_num_columns", (DL_FUNC) &_arrow_Table_num_columns, 1},
11621164
{"_arrow_Table_num_rows", (DL_FUNC) &_arrow_Table_num_rows, 1},
11631165
{"_arrow_Table_schema", (DL_FUNC) &_arrow_Table_schema, 1},
1164-
{"_arrow_RecordBatch_to_file", (DL_FUNC) &_arrow_RecordBatch_to_file, 2},
1165-
{"_arrow_read_record_batch_", (DL_FUNC) &_arrow_read_record_batch_, 1},
11661166
{"_arrow_Table_to_file", (DL_FUNC) &_arrow_Table_to_file, 2},
11671167
{"_arrow_read_table_", (DL_FUNC) &_arrow_read_table_, 1},
11681168
{"_arrow_Table_to_dataframe", (DL_FUNC) &_arrow_Table_to_dataframe, 1},

0 commit comments

Comments
 (0)