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

Function delay

cpp/src/arrow/dataset/file_test.cc:368–383  ·  view source on GitHub ↗

This kernel delays execution for some specific scalar values, which guarantees the writing phase sees out-of-order exec batches

Source from the content-addressed store, hash-verified

366// This kernel delays execution for some specific scalar values,
367// which guarantees the writing phase sees out-of-order exec batches
368Status delay(compute::KernelContext* ctx, const compute::ExecSpan& batch,
369 compute::ExecResult* out) {
370 const ArraySpan& input = batch[0].array;
371 const auto* input_values = input.GetValues<uint32_t>(1);
372 uint8_t* output_values = out->array_span()->buffers[1].data;
373
374 // Boolean data is stored in 1 bit per value
375 for (int64_t i = 0; i < input.length; ++i) {
376 if (input_values[i] % 16 == 0) {
377 std::this_thread::sleep_for(std::chrono::milliseconds(10));
378 }
379 bit_util::SetBitTo(output_values, i, true);
380 }
381
382 return Status::OK();
383}
384
385// A fragment with start=0 will defer ScanBatchesAsync returning a batch generator
386// This guarantees a dataset of multiple fragments could produce out-of-order batches

Callers

nothing calls this directly

Calls 2

SetBitToFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected