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

Function MaskArrayWithNullsAt

cpp/src/arrow/compute/kernels/scalar_cast_test.cc:143–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static std::shared_ptr<Array> MaskArrayWithNullsAt(std::shared_ptr<Array> input,
144 std::vector<int> indices_to_mask) {
145 auto masked = input->data()->Copy();
146 masked->buffers[0] = *AllocateEmptyBitmap(input->length());
147 masked->null_count = kUnknownNullCount;
148
149 using arrow::internal::Bitmap;
150 Bitmap is_valid(masked->buffers[0], 0, input->length());
151 if (auto original = input->null_bitmap()) {
152 is_valid.CopyFrom(Bitmap(original, input->offset(), input->length()));
153 } else {
154 is_valid.SetBitsTo(true);
155 }
156
157 for (int i : indices_to_mask) {
158 is_valid.SetBitTo(i, false);
159 }
160 return MakeArray(masked);
161}
162
163TEST(Cast, CanCast) {
164 auto ExpectCanCast = [](std::shared_ptr<DataType> from,

Callers 1

TESTFunction · 0.85

Calls 8

AllocateEmptyBitmapFunction · 0.85
MakeArrayFunction · 0.70
BitmapFunction · 0.50
CopyMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45
CopyFromMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected