Skip to content

Commit 38cc796

Browse files
committed
Remove unused fcts
1 parent 31bc8df commit 38cc796

File tree

3 files changed

+11
-59
lines changed

3 files changed

+11
-59
lines changed

include/sparrow_ipc/deserialize_utils.hpp

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,22 @@ namespace sparrow_ipc::utils
3232
);
3333

3434
/**
35-
* @brief Extracts bitmap pointer and null count from a RecordBatch buffer.
36-
*
37-
* This function retrieves a bitmap buffer from the specified index in the RecordBatch's
38-
* buffer list and calculates the number of null values represented by the bitmap.
35+
* @brief Extracts a buffer from a RecordBatch's body.
3936
*
40-
* @param record_batch The Arrow RecordBatch containing buffer metadata
41-
* @param body The raw buffer data as a byte span
42-
* @param index The index of the bitmap buffer in the RecordBatch's buffer list
37+
* This function retrieves a buffer span from the specified index in the RecordBatch's
38+
* buffer list and increments the index.
4339
*
44-
* @return A pair containing:
45-
* - First: Pointer to the bitmap data (nullptr if buffer is empty)
46-
* - Second: Count of null values in the bitmap (0 if buffer is empty)
40+
* @param record_batch The Arrow RecordBatch containing buffer metadata.
41+
* @param body The raw buffer data as a byte span.
42+
* @param buffer_index The index of the buffer to retrieve. This value is incremented by the function.
4743
*
48-
* @note If the bitmap buffer has zero length, returns {nullptr, 0}
49-
* @note The returned pointer is a non-const cast of the original const data
44+
* @return A `std::span<const uint8_t>` viewing the extracted buffer data.
45+
* @throws std::runtime_error if the buffer metadata indicates a buffer that exceeds the body size.
5046
*/
51-
// TODO to be removed when not used anymore (after adding compression to deserialize_fixedsizebinary_array)
52-
[[nodiscard]] std::pair<std::uint8_t*, int64_t> get_bitmap_pointer_and_null_count(
47+
[[nodiscard]] std::span<const uint8_t> get_buffer(
5348
const org::apache::arrow::flatbuf::RecordBatch& record_batch,
5449
std::span<const uint8_t> body,
55-
size_t index
50+
size_t& buffer_index
5651
);
5752

5853
/**
@@ -72,23 +67,4 @@ namespace sparrow_ipc::utils
7267
std::span<const uint8_t> buffer_span,
7368
const org::apache::arrow::flatbuf::BodyCompression* compression
7469
);
75-
76-
/**
77-
* @brief Extracts a buffer from a RecordBatch's body.
78-
*
79-
* This function retrieves a buffer span from the specified index in the RecordBatch's
80-
* buffer list and increments the index.
81-
*
82-
* @param record_batch The Arrow RecordBatch containing buffer metadata.
83-
* @param body The raw buffer data as a byte span.
84-
* @param buffer_index The index of the buffer to retrieve. This value is incremented by the function.
85-
*
86-
* @return A `std::span<const uint8_t>` viewing the extracted buffer data.
87-
* @throws std::runtime_error if the buffer metadata indicates a buffer that exceeds the body size.
88-
*/
89-
[[nodiscard]] std::span<const uint8_t> get_buffer(
90-
const org::apache::arrow::flatbuf::RecordBatch& record_batch,
91-
std::span<const uint8_t> body,
92-
size_t& buffer_index
93-
);
9470
}

src/deserialize_utils.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace sparrow_ipc::utils
66
{
7-
// TODO check and remove unused fcts?
87
std::pair<std::uint8_t*, int64_t> get_bitmap_pointer_and_null_count(
98
std::span<const uint8_t> validity_buffer_span,
109
const int64_t length
@@ -22,29 +21,6 @@ namespace sparrow_ipc::utils
2221
return {ptr, bitmap_view.null_count()};
2322
}
2423

25-
std::pair<std::uint8_t*, int64_t> get_bitmap_pointer_and_null_count(
26-
const org::apache::arrow::flatbuf::RecordBatch& record_batch,
27-
std::span<const uint8_t> body,
28-
size_t index
29-
)
30-
{
31-
const auto bitmap_metadata = record_batch.buffers()->Get(index);
32-
if (bitmap_metadata->length() == 0)
33-
{
34-
return {nullptr, 0};
35-
}
36-
if (body.size() < (bitmap_metadata->offset() + bitmap_metadata->length()))
37-
{
38-
throw std::runtime_error("Bitmap buffer exceeds body size");
39-
}
40-
auto ptr = const_cast<uint8_t*>(body.data() + bitmap_metadata->offset());
41-
const sparrow::dynamic_bitset_view<const std::uint8_t> bitmap_view{
42-
ptr,
43-
static_cast<size_t>(record_batch.length())
44-
};
45-
return {ptr, bitmap_view.null_count()};
46-
}
47-
4824
std::span<const uint8_t> get_buffer(
4925
const org::apache::arrow::flatbuf::RecordBatch& record_batch,
5026
std::span<const uint8_t> body,

tests/test_serialize_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ namespace sparrow_ipc
113113
CHECK_EQ(size % 8, 0);
114114
std::vector<uint8_t> serialized;
115115
memory_output_stream stream(serialized);
116-
any_output_stream astream(stream);
116+
any_output_stream astream(stream);
117117
generate_body(record_batch, astream);
118118
CHECK_EQ(size, static_cast<int64_t>(serialized.size()));
119119
}

0 commit comments

Comments
 (0)