apache / arrow

Apache Arrow is the universal columnar format and multi-language toolbox for fast data interchange and in-memory analytics
https://arrow.apache.org/
Apache License 2.0
14.64k stars 3.56k forks source link

[C++] Fix PartitionSort example. #44677

Closed Light-City closed 1 week ago

Light-City commented 2 weeks ago

Describe the bug, including details regarding any error messages, version, and platform.

  /// For example:
  ///
  /// in_arr: [5, 7, 2, 3, 5, 4]
  /// num_prtns: 3
  /// prtn_id_impl: [&in_arr] (int row_id) { return in_arr[row_id] / 3; }
  /// output_pos_impl: [&out_arr] (int row_id, int pos) { out_arr[pos] = row_id; }
  ///

output should be:

  /// out_arr: [2, 0, 3, 4, 5, 1]
  /// prtn_ranges: [0, 1, 5, 6]

but now is:

  /// out_arr: [2, 5, 3, 5, 4, 7]
  /// prtn_ranges: [0, 1, 5, 6]

out_arr value is row id not actual value.

Component(s)

C++

mapleFU commented 1 week ago

Issue resolved by pull request 44678 https://github.com/apache/arrow/pull/44678