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

Method Execute

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

Source from the content-addressed store, hash-verified

781class ScalarExecutor : public KernelExecutorImpl<ScalarKernel> {
782 public:
783 Status Execute(const ExecBatch& batch, ExecListener* listener) override {
784 RETURN_NOT_OK(span_iterator_.Init(batch, exec_context()->exec_chunksize()));
785
786 if (batch.length == 0) {
787 // For zero-length batches, we do nothing except return a zero-length
788 // array of the correct output type
789 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Array> result,
790 MakeArrayOfNull(output_type_.GetSharedPtr(), /*length=*/0,
791 exec_context()->memory_pool()));
792 return EmitResult(result->data(), listener);
793 }
794
795 // If the executor is configured to produce a single large Array output for
796 // kernels supporting preallocation, then we do so up front and then
797 // iterate over slices of that large array. Otherwise, we preallocate prior
798 // to processing each span emitted from the ExecSpanIterator
799 RETURN_NOT_OK(SetupPreallocation(span_iterator_.length(), batch.values));
800
801 // ARROW-16756: Here we have to accommodate the distinct cases
802 //
803 // * Fully-preallocated contiguous output
804 // * Fully-preallocated, non-contiguous kernel output
805 // * Not-fully-preallocated kernel output: we pass an empty or
806 // partially-filled ArrayData to the kernel
807 if (preallocating_all_buffers_) {
808 return ExecuteSpans(listener);
809 } else {
810 return ExecuteNonSpans(listener);
811 }
812 }
813
814 Datum WrapResults(const std::vector<Datum>& inputs,
815 const std::vector<Datum>& outputs) override {

Callers

nothing calls this directly

Calls 7

MakeArrayOfNullFunction · 0.85
exec_contextFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
InitMethod · 0.45
memory_poolMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected