Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-13121

[C++][Compute] Extract preallocation logic from KernelExecutor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++
    • None

    Description

      Currently KernelExecutor handles preallocation of null bitmaps and other buffers based on simple flags on each Kernel. This is not very flexible and we end up leaving a lot of performance on the table in cases where we can preallocate but the behavior can't be captured in the available flags. For example, in the case of binary_string_join_element_wise, it would be possible to preallocate all buffers (even the character buffer) and write output into slices.

      Having this as a public function would enable us to unit test it directly (currently Executors are only tested indirectly through calling of compute::Functions) and reuse it, for example to correctly preallocate a small temporary for pipelined execution

      One way this could be added is as a new method on each Kernel:

      // Output preallocated Datums sufficient for execution of the kernel on each ExecBatch.
      // The output Datums may not be identically chunked to the input batches, for example
      // kernels which support contiguous output preallocation will preallocate a single Datum
      // (and can then output into slices of that Datum).
      Result<std::vector<Datum>> Kernel::prepare_output(
        const Kernel*,
        KernelContext*,
        const std::vector<ExecBatch>& inputs)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bkietz Ben Kietzman
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: