@@ -468,13 +468,13 @@ namespace sparrow_ipc
468468 ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<org::apache::arrow::flatbuf::Field>>>
469469 create_children (flatbuffers::FlatBufferBuilder& builder, const sparrow::record_batch& record_batch)
470470 {
471- const auto & columns = record_batch.columns ();
472471 std::vector<flatbuffers::Offset<org::apache::arrow::flatbuf::Field>> children_vec;
473- children_vec.reserve (columns. size ());
472+ children_vec.reserve (record_batch. nb_columns ());
474473 const auto names = record_batch.names ();
475- for (size_t i = 0 ; i < columns. size (); ++i)
474+ for (size_t i = 0 ; i < record_batch. nb_columns (); ++i)
476475 {
477- const auto & arrow_schema = sparrow::detail::array_access::get_arrow_proxy (columns[i]).schema ();
476+ const auto & column = record_batch.get_column (i);
477+ const auto & arrow_schema = sparrow::detail::array_access::get_arrow_proxy (column).schema ();
478478 flatbuffers::Offset<org::apache::arrow::flatbuf::Field> field = create_field (
479479 builder,
480480 arrow_schema,
@@ -523,9 +523,10 @@ namespace sparrow_ipc
523523 create_fieldnodes (const sparrow::record_batch& record_batch)
524524 {
525525 std::vector<org::apache::arrow::flatbuf::FieldNode> nodes;
526- nodes.reserve (record_batch.columns (). size ());
527- for (const auto & column : record_batch.columns () )
526+ nodes.reserve (record_batch.nb_columns ());
527+ for (size_t i = 0 ; i < record_batch.nb_columns (); ++i )
528528 {
529+ const auto & column = record_batch.get_column (i);
529530 fill_fieldnodes (sparrow::detail::array_access::get_arrow_proxy (column), nodes);
530531 }
531532 return nodes;
@@ -608,16 +609,14 @@ namespace sparrow_ipc
608609 std::optional<CompressionType> compression,
609610 std::optional<std::reference_wrapper<CompressionCache>> cache)
610611 {
611- return std::accumulate (
612- record_batch.columns ().begin (),
613- record_batch.columns ().end (),
614- int64_t {0 },
615- [&](int64_t acc, const sparrow::array& arr)
616- {
617- const auto & arrow_proxy = sparrow::detail::array_access::get_arrow_proxy (arr);
618- return acc + calculate_body_size (arrow_proxy, compression, cache);
619- }
620- );
612+ int64_t acc = 0 ;
613+ for (size_t i = 0 ; i < record_batch.nb_columns (); ++i)
614+ {
615+ const auto & arr = record_batch.get_column (i);
616+ const auto & arrow_proxy = sparrow::detail::array_access::get_arrow_proxy (arr);
617+ acc += calculate_body_size (arrow_proxy, compression, cache);
618+ }
619+ return acc;
621620 }
622621
623622 flatbuffers::FlatBufferBuilder get_record_batch_message_builder (const sparrow::record_batch& record_batch,
0 commit comments