@@ -34,45 +34,6 @@ namespace sparrow_ipc
3434 });
3535 }
3636
37- int64_t calculate_body_size (const sparrow::arrow_proxy& arrow_proxy, std::optional<CompressionType> compression)
38- {
39- int64_t total_size = 0 ;
40- if (compression.has_value ())
41- {
42- for (const auto & buffer : arrow_proxy.buffers ())
43- {
44- total_size += utils::align_to_8 (compress (compression.value (), std::span<const uint8_t >(buffer.data (), buffer.size ())).size ());
45- }
46- }
47- else
48- {
49- for (const auto & buffer : arrow_proxy.buffers ())
50- {
51- total_size += utils::align_to_8 (buffer.size ());
52- }
53- }
54-
55- for (const auto & child : arrow_proxy.children ())
56- {
57- total_size += calculate_body_size (child, compression);
58- }
59- return total_size;
60- }
61-
62- int64_t calculate_body_size (const sparrow::record_batch& record_batch, std::optional<CompressionType> compression)
63- {
64- return std::accumulate (
65- record_batch.columns ().begin (),
66- record_batch.columns ().end (),
67- int64_t {0 },
68- [&](int64_t acc, const sparrow::array& arr)
69- {
70- const auto & arrow_proxy = sparrow::detail::array_access::get_arrow_proxy (arr);
71- return acc + calculate_body_size (arrow_proxy, compression);
72- }
73- );
74- }
75-
7637 std::size_t calculate_schema_message_size (const sparrow::record_batch& record_batch)
7738 {
7839 // Build the schema message to get its exact size
@@ -108,26 +69,6 @@ namespace sparrow_ipc
10869 return metadata_size + actual_body_size;
10970 }
11071
111- std::vector<org::apache::arrow::flatbuf::Buffer>
112- generate_compressed_buffers (const sparrow::record_batch& record_batch, const CompressionType compression_type)
113- {
114- std::vector<org::apache::arrow::flatbuf::Buffer> compressed_buffers;
115- int64_t current_offset = 0 ;
116-
117- for (const auto & column : record_batch.columns ())
118- {
119- const auto & arrow_proxy = sparrow::detail::array_access::get_arrow_proxy (column);
120- for (const auto & buffer : arrow_proxy.buffers ())
121- {
122- std::vector<uint8_t > compressed_buffer_with_header = compress (compression_type, std::span<const uint8_t >(buffer.data (), buffer.size ()));
123- const size_t aligned_chunk_size = utils::align_to_8 (compressed_buffer_with_header.size ());
124- compressed_buffers.emplace_back (current_offset, aligned_chunk_size);
125- current_offset += aligned_chunk_size;
126- }
127- }
128- return compressed_buffers;
129- }
130-
13172 std::vector<sparrow::data_type> get_column_dtypes (const sparrow::record_batch& rb)
13273 {
13374 std::vector<sparrow::data_type> dtypes;
0 commit comments