Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-32884: [C++] Add ordered aggregation #34311

Merged
merged 30 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b2b10cf
GH-32884: [C++] Add ordered aggregation
rtpsw Feb 23, 2023
636701e
Merge branch 'main' into GH-32884
rtpsw Feb 23, 2023
70acbe6
requested fixes
rtpsw Feb 24, 2023
78af85e
fix integer conversion
rtpsw Feb 24, 2023
9627ddf
simplify
rtpsw Feb 25, 2023
6240596
remove unused
rtpsw Feb 25, 2023
01a946b
requested fixes
rtpsw Mar 1, 2023
54a5809
Simply some segment code; add documentation; some refactor/renames
icexelloss Mar 2, 2023
e96ac77
Rename segment piece back to segment
icexelloss Mar 3, 2023
1c4579b
Format change
icexelloss Mar 3, 2023
192dc87
Fix comment w.r.t segment/segment group
icexelloss Mar 3, 2023
c92f8d0
Fix docstring for segment
icexelloss Mar 3, 2023
5ac8c65
Merge pull request #1 from icexelloss/GH-32884-ordered-agg
rtpsw Mar 3, 2023
111a7b9
add plan tests
rtpsw Mar 4, 2023
d85dac3
requested changes
rtpsw Mar 4, 2023
28fce61
reinstate state resize
rtpsw Mar 4, 2023
218e04c
add tests and fix
rtpsw Mar 5, 2023
4f18abd
fix vector access
rtpsw Mar 5, 2023
a633038
requested changes
rtpsw Mar 6, 2023
e52439c
Minor doc/rename changes
icexelloss Mar 6, 2023
7edcb18
fix typo
icexelloss Mar 6, 2023
48d39eb
requested changes
rtpsw Mar 7, 2023
967a07c
add export
rtpsw Mar 7, 2023
d76323c
Fix docstring
icexelloss Mar 7, 2023
7b6e953
Merge pull request #2 from icexelloss/GH-32884-ordered-agg
rtpsw Mar 7, 2023
5e8cbc9
requested changes
rtpsw Mar 7, 2023
d68efd4
requested changes, additional tests
rtpsw Mar 7, 2023
b11a6ca
requested changes
rtpsw Mar 8, 2023
9e094fc
doc and simplify segmenter grouping
rtpsw Mar 8, 2023
6295691
requested changes
rtpsw Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cpp/src/arrow/compute/exec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ ExecBatch ExecBatch::Slice(int64_t offset, int64_t length) const {
return out;
}

Result<ExecBatch> ExecBatch::SelectValues(const std::vector<int>& ids) const {
std::vector<Datum> selected_values;
selected_values.reserve(ids.size());
for (int id : ids) {
if (id < 0 || static_cast<size_t>(id) >= values.size()) {
return Status::Invalid("ExecBatch invalid value selection: ", id);
}
selected_values.push_back(values[id]);
}
return ExecBatch(std::move(selected_values), length);
}

namespace {

enum LengthInferenceError {
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/arrow/compute/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ struct ARROW_EXPORT ExecBatch {
/// \brief Infer the ExecBatch length from values.
static Result<int64_t> InferLength(const std::vector<Datum>& values);

/// Creates an ExecBatch with length-validation.
///
/// If any value is given, then all values must have a common length. If the given
/// length is negative, then the length of the ExecBatch is set to this common length,
/// or to 1 if no values are given. Otherwise, the given length must equal the common
/// length, if any value is given.
static Result<ExecBatch> Make(std::vector<Datum> values, int64_t length = -1);

Result<std::shared_ptr<RecordBatch>> ToRecordBatch(
Expand Down Expand Up @@ -240,6 +246,8 @@ struct ARROW_EXPORT ExecBatch {

ExecBatch Slice(int64_t offset, int64_t length) const;

Result<ExecBatch> SelectValues(const std::vector<int>& ids) const;
icexelloss marked this conversation as resolved.
Show resolved Hide resolved

/// \brief A convenience for returning the types from the batch.
std::vector<TypeHolder> GetTypes() const {
std::vector<TypeHolder> result;
Expand Down
Loading