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

Function GetTruncatedBuffer

cpp/src/arrow/ipc/writer.cc:105–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105Status GetTruncatedBuffer(int64_t offset, int64_t length, int32_t byte_width,
106 const std::shared_ptr<Buffer>& input, MemoryPool* pool,
107 std::shared_ptr<Buffer>* buffer) {
108 if (!input) {
109 *buffer = input;
110 return Status::OK();
111 }
112 int64_t padded_length = PaddedLength(length * byte_width);
113 if (offset != 0 || padded_length < input->size()) {
114 *buffer =
115 SliceBuffer(input, offset * byte_width, std::min(padded_length, input->size()));
116 } else {
117 *buffer = input;
118 }
119 return Status::OK();
120}
121
122static inline bool NeedTruncate(int64_t offset, const Buffer* buffer,
123 int64_t min_length) {

Callers 1

VisitMethod · 0.85

Calls 4

SliceBufferFunction · 0.85
PaddedLengthFunction · 0.70
OKFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected