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

Method StartProducing

cpp/src/arrow/acero/tpch_node.cc:3296–3322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3294 }
3295
3296 Status StartProducing(size_t num_threads, OutputBatchCallback output_callback,
3297 FinishedCallback finished_callback,
3298 ScheduleCallback /*schedule_task_callback*/) override {
3299 std::shared_ptr<Buffer> R_REGIONKEY_buffer = Buffer::Wrap(kRegionKey, kRowCount);
3300 ArrayData R_REGIONKEY_arraydata(int32(), kRowCount,
3301 {nullptr, std::move(R_REGIONKEY_buffer)});
3302
3303 ARROW_ASSIGN_OR_RAISE(std::unique_ptr<Buffer> R_NAME_buffer,
3304 AllocateBuffer(kRowCount * kNameByteWidth));
3305 char* R_NAME_data = reinterpret_cast<char*>(R_NAME_buffer->mutable_data());
3306 for (size_t i = 0; i < kRowCount; i++)
3307 std::strncpy(R_NAME_data + kNameByteWidth * i, kRegionNames[i], kNameByteWidth);
3308 ArrayData R_NAME_arraydata(kTypes[static_cast<int>(REGION::R_NAME)], kRowCount,
3309 {nullptr, std::move(R_NAME_buffer)});
3310
3311 ARROW_ASSIGN_OR_RAISE(Datum R_COMMENT_datum,
3312 g_text.GenerateComments(kRowCount, 31, 115, rng_));
3313
3314 std::vector<Datum> fields = {std::move(R_REGIONKEY_arraydata),
3315 std::move(R_NAME_arraydata), std::move(R_COMMENT_datum)};
3316 std::vector<Datum> result;
3317 for (const int& col : column_indices_) result.push_back(fields[col]);
3318 ARROW_ASSIGN_OR_RAISE(ExecBatch batch, ExecBatch::Make(std::move(result)));
3319 ARROW_RETURN_NOT_OK(output_callback(std::move(batch)));
3320 ARROW_RETURN_NOT_OK(finished_callback(static_cast<int64_t>(1)));
3321 return Status::OK();
3322 }
3323
3324 std::shared_ptr<Schema> schema() const override { return schema_; }
3325

Callers

nothing calls this directly

Calls 6

WrapFunction · 0.85
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
AllocateBufferFunction · 0.50
OKFunction · 0.50
mutable_dataMethod · 0.45

Tested by

no test coverage detected