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

Method StartProducing

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

Source from the content-addressed store, hash-verified

3200 }
3201
3202 Status StartProducing(size_t /*num_threads*/, OutputBatchCallback output_callback,
3203 FinishedCallback finished_callback,
3204 ScheduleCallback /*schedule_task_callback*/) override {
3205 std::shared_ptr<Buffer> N_NATIONKEY_buffer = Buffer::Wrap(kNationKey, kRowCount);
3206 ArrayData N_NATIONKEY_arraydata(int32(), kRowCount,
3207 {nullptr, std::move(N_NATIONKEY_buffer)});
3208
3209 ARROW_ASSIGN_OR_RAISE(std::unique_ptr<Buffer> N_NAME_buffer,
3210 AllocateBuffer(kRowCount * kNameByteWidth));
3211 char* N_NAME = reinterpret_cast<char*>(N_NAME_buffer->mutable_data());
3212 for (size_t i = 0; i < kRowCount; i++)
3213 std::strncpy(N_NAME + kNameByteWidth * i, kCountryNames[i], kNameByteWidth);
3214 ArrayData N_NAME_arraydata(fixed_size_binary(kNameByteWidth), kRowCount,
3215 {nullptr, std::move(N_NAME_buffer)});
3216
3217 std::shared_ptr<Buffer> N_REGIONKEY_buffer = Buffer::Wrap(kRegionKey, kRowCount);
3218 ArrayData N_REGIONKEY_arraydata(int32(), kRowCount,
3219 {nullptr, std::move(N_REGIONKEY_buffer)});
3220
3221 ARROW_ASSIGN_OR_RAISE(Datum N_COMMENT_datum,
3222 g_text.GenerateComments(kRowCount, 31, 114, rng_));
3223
3224 std::vector<Datum> fields = {
3225 std::move(N_NATIONKEY_arraydata), std::move(N_NAME_arraydata),
3226 std::move(N_REGIONKEY_arraydata), std::move(N_COMMENT_datum)};
3227
3228 std::vector<Datum> result;
3229 for (const int& col : column_indices_) result.push_back(fields[col]);
3230 ARROW_ASSIGN_OR_RAISE(ExecBatch batch, ExecBatch::Make(std::move(result)));
3231 ARROW_RETURN_NOT_OK(output_callback(std::move(batch)));
3232 return finished_callback(static_cast<int64_t>(1));
3233 }
3234
3235 std::shared_ptr<Schema> schema() const override { return schema_; }
3236

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected