extract the null bitmap from the leading nullity bytes of encoded keys
| 31 | |
| 32 | // extract the null bitmap from the leading nullity bytes of encoded keys |
| 33 | Status KeyEncoder::DecodeNulls(MemoryPool* pool, int32_t length, uint8_t** encoded_bytes, |
| 34 | std::shared_ptr<Buffer>* null_bitmap, |
| 35 | int32_t* null_count) { |
| 36 | // first count nulls to determine if a null bitmap is necessary |
| 37 | *null_count = 0; |
| 38 | for (int32_t i = 0; i < length; ++i) { |
| 39 | *null_count += (encoded_bytes[i][0] == kNullByte); |
| 40 | } |
| 41 | |
| 42 | if (*null_count > 0) { |
| 43 | ARROW_ASSIGN_OR_RAISE(*null_bitmap, AllocateBitmap(length, pool)); |
| 44 | uint8_t* validity = (*null_bitmap)->mutable_data(); |
| 45 | |
| 46 | FirstTimeBitmapWriter writer(validity, 0, length); |
| 47 | for (int32_t i = 0; i < length; ++i) { |
| 48 | if (encoded_bytes[i][0] == kValidByte) { |
| 49 | writer.Set(); |
| 50 | } else { |
| 51 | writer.Clear(); |
| 52 | } |
| 53 | writer.Next(); |
| 54 | encoded_bytes[i] += 1; |
| 55 | } |
| 56 | writer.Finish(); |
| 57 | } else { |
| 58 | for (int32_t i = 0; i < length; ++i) { |
| 59 | encoded_bytes[i] += 1; |
| 60 | } |
| 61 | } |
| 62 | return Status ::OK(); |
| 63 | } |
| 64 | |
| 65 | void BooleanKeyEncoder::AddLength(const ExecValue&, int64_t batch_length, |
| 66 | int32_t* lengths) { |
nothing calls this directly
no test coverage detected