Skip to content

Commit

Permalink
Update cpp/arcticdb/processing/clause.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
  • Loading branch information
JohanMabille and jjerphan committed Nov 21, 2023
1 parent 1b6d3d1 commit 51f928e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cpp/arcticdb/processing/clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Composite<ProcessingUnit> AggregationClause::process(std::shared_ptr<Store> stor
// Not worth worrying about right now
robin_hood::unordered_flat_map<RawType, size_t> offset_to_group;

bool is_sparse = col.column_->is_sparse();
const bool is_sparse = col.column_->is_sparse();
using optional_iter_type = std::optional<decltype(input_data.bit_vector()->first())>;
optional_iter_type iter = std::nullopt;
size_t previous_value_index = 0;
Expand Down Expand Up @@ -341,10 +341,10 @@ Composite<ProcessingUnit> AggregationClause::process(std::shared_ptr<Store> stor
val = *ptr;
}
if (is_sparse) {
for (size_t j = previous_value_index + 1; j != *(iter.value()); ++j) {
for (size_t j = previous_value_index; j != *(iter.value()); ++j) {
row_to_group.emplace_back(missing_value_group_id);
}
previous_value_index = *(iter.value());
previous_value_index = *(iter.value()) + 1;
++(iter.value());
}

Expand All @@ -358,9 +358,9 @@ Composite<ProcessingUnit> AggregationClause::process(std::shared_ptr<Store> stor
}
}

# Marking all the last non-represented values as missing.
// Marking all the last non-represented values as missing.
for (size_t i = row_to_group.size(); i <= size_t(col.column_->last_row()); ++i) {
row_to_group.emplace_back(missing_values_group_id);
row_to_group.emplace_back(missing_value_group_id);
}

num_unique = next_group_id;
Expand Down
4 changes: 2 additions & 2 deletions cpp/arcticdb/processing/test/test_clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ TEST(Clause, AggregationSparseGroupby) {
ASSERT_EQ(1, slice_and_keys.size());

using aggregation_test::check_column;
check_column<int64_t>(slice_and_keys[0], "sum_int", unique_groups, [unique_groups](size_t idx) -> int64_t {
check_column<int64_t>(slice_and_keys[0], "sum_int", unique_groups, [unique_grouping_values](size_t idx) -> int64_t {
if (idx == 0) {
return 495;
} else {
Expand All @@ -293,7 +293,7 @@ TEST(Clause, AggregationSparseGroupby) {
return idx;
}
});
check_column<int64_t>(slice_and_keys[0], "max_int", unique_groups, [unique_groups](size_t idx) -> int64_t {
check_column<int64_t>(slice_and_keys[0], "max_int", unique_groups, [unique_grouping_values](size_t idx) -> int64_t {
if (idx == 0) {
return 99;
}
Expand Down

0 comments on commit 51f928e

Please sign in to comment.