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

Method ExecuteSpans

cpp/src/arrow/compute/exec.cc:838–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836 }
837
838 Status ExecuteSpans(ExecListener* listener) {
839 // We put the preallocation in an ArraySpan to be passed to the
840 // kernel which is expecting to receive that. More
841 // performance-critical code (e.g. expression evaluation) should
842 // eventually skip the creation of ArrayData altogether
843 std::shared_ptr<ArrayData> preallocation;
844 ExecSpan input;
845 ExecResult output;
846 ArraySpan* output_span = output.array_span_mutable();
847
848 if (preallocate_contiguous_) {
849 // Make one big output allocation
850 ARROW_ASSIGN_OR_RAISE(preallocation, PrepareOutput(span_iterator_.length()));
851
852 // Populate and then reuse the ArraySpan inside
853 output_span->SetMembers(*preallocation);
854 output_span->offset = 0;
855 int64_t result_offset = 0;
856 while (span_iterator_.Next(&input)) {
857 // Set absolute output span position and length
858 output_span->SetSlice(result_offset, input.length);
859 RETURN_NOT_OK(ExecuteSingleSpan(input, &output));
860 result_offset = span_iterator_.position();
861 }
862
863 // Kernel execution is complete; emit result
864 return EmitResult(std::move(preallocation), listener);
865 } else {
866 // Fully preallocating, but not contiguously
867 // We preallocate (maybe) only for the output of processing the current
868 // chunk
869 while (span_iterator_.Next(&input)) {
870 ARROW_ASSIGN_OR_RAISE(preallocation, PrepareOutput(input.length));
871 output_span->SetMembers(*preallocation);
872 RETURN_NOT_OK(ExecuteSingleSpan(input, &output));
873 // Emit the result for this chunk
874 RETURN_NOT_OK(EmitResult(std::move(preallocation), listener));
875 }
876 return Status::OK();
877 }
878 }
879
880 Status ExecuteSingleSpan(const ExecSpan& input, ExecResult* out) {
881 ArraySpan* result_span = out->array_span_mutable();

Callers

nothing calls this directly

Calls 7

PrepareOutputFunction · 0.85
SetMembersMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
lengthMethod · 0.45
NextMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected