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

[C++][Compute] Make aggregate kernel merge state mutable

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • C++

    Description

      Aggregate kernel consumes each batch and output a state, which is then merged with other batches. Currently, state parameter is defined as const KernelState& in merge interface. It may cause unnecessary data copying for kernels with non-trivial states.
      E.g., mode kernel maintains a value:count map in its state structure, it's better to move the map than copy it (for merge operation of the first batch).

      Aggregate kernel code template is at [1]. batch_state is an auto variable(line 873), modifying it in kernel->merge() is okay (line 888).

      [1] https://github.com/apache/arrow/blob/a17717fa528bb7d495cfba5c6b5fb67866934a63/cpp/src/arrow/compute/exec.cc#L871-L891

      Attachments

        Issue Links

          Activity

            People

              yibocai Yibo Cai
              yibocai Yibo Cai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h

                  Slack

                    Issue deployment