| 146 | }; |
| 147 | |
| 148 | void NullColumnBuilder::Insert(int64_t block_index, |
| 149 | const std::shared_ptr<BlockParser>& parser) { |
| 150 | ReserveChunks(block_index); |
| 151 | |
| 152 | // Spawn a task that will build an array of nulls with the right DataType |
| 153 | const int32_t num_rows = parser->num_rows(); |
| 154 | DCHECK_GE(num_rows, 0); |
| 155 | |
| 156 | // `self` keeps us alive, `this` allows easy access to derived / protected member vars |
| 157 | task_group_->Append( |
| 158 | [self = shared_from_this(), this, block_index, num_rows]() -> Status { |
| 159 | std::unique_ptr<ArrayBuilder> builder; |
| 160 | RETURN_NOT_OK(MakeBuilder(pool_, type_, &builder)); |
| 161 | std::shared_ptr<Array> res; |
| 162 | RETURN_NOT_OK(builder->AppendNulls(num_rows)); |
| 163 | RETURN_NOT_OK(builder->Finish(&res)); |
| 164 | |
| 165 | return SetChunk(block_index, res); |
| 166 | }); |
| 167 | } |
| 168 | |
| 169 | ////////////////////////////////////////////////////////////////////////// |
| 170 | // Pre-typed column builder implementation |