MCPcopy Create free account
hub / github.com/apache/arrow / RecordBatch__cast

Function RecordBatch__cast

r/src/compute.cpp:34–47  ·  view source on GitHub ↗

[[arrow::export]]

Source from the content-addressed store, hash-verified

32
33// [[arrow::export]]
34std::shared_ptr<arrow::RecordBatch> RecordBatch__cast(
35 const std::shared_ptr<arrow::RecordBatch>& batch,
36 const std::shared_ptr<arrow::Schema>& schema, cpp11::list options) {
37 auto opts = make_cast_options(options);
38 auto nc = batch->num_columns();
39
40 arrow::ArrayVector columns(nc);
41 for (int i = 0; i < nc; i++) {
42 columns[i] = ValueOrStop(
43 arrow::compute::Cast(*batch->column(i), schema->field(i)->type(), *opts));
44 }
45
46 return arrow::RecordBatch::Make(schema, batch->num_rows(), std::move(columns));
47}
48
49// [[arrow::export]]
50std::shared_ptr<arrow::Table> Table__cast(const std::shared_ptr<arrow::Table>& table,

Callers 1

_arrow_RecordBatch__castFunction · 0.85

Calls 9

make_cast_optionsFunction · 0.85
ValueOrStopFunction · 0.85
CastFunction · 0.85
MakeFunction · 0.50
num_columnsMethod · 0.45
columnMethod · 0.45
typeMethod · 0.45
fieldMethod · 0.45
num_rowsMethod · 0.45

Tested by

no test coverage detected