Skip to content

Commit

Permalink
code revise
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasmine-ge committed Sep 2, 2024
1 parent cceecdd commit 3ae578d
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/AggregateFunctions/Streaming/AggregateFunctionDistinct.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,12 @@ struct AggregateFunctionDistinctSingleNumericData
{
if (rhs.set.find(*it) != rhs.set.end())
{
auto found = std::find(rhs.extra_data_since_last_finalize.begin(), rhs.extra_data_since_last_finalize.end(), *it);
if (found == rhs.extra_data_since_last_finalize.end())
{
it = extra_data_since_last_finalize.erase(it);
}
else
{
bool is_new_data = std::find(rhs.extra_data_since_last_finalize.begin(), rhs.extra_data_since_last_finalize.end(), *it)
!= rhs.extra_data_since_last_finalize.end();
if (is_new_data)
++it;
}
else
it = extra_data_since_last_finalize.erase(it);
}
else
{
Expand Down Expand Up @@ -188,9 +185,18 @@ struct AggregateFunctionDistinctGenericData
for (auto next = extra_data_since_last_finalize.begin(); next != extra_data_since_last_finalize.end();)
{
if (rhs.set.find(*next) != rhs.set.end())
next = extra_data_since_last_finalize.erase(next);
{
bool is_new_data = std::find(rhs.extra_data_since_last_finalize.begin(), rhs.extra_data_since_last_finalize.end(), *next)
!= rhs.extra_data_since_last_finalize.end();
if (is_new_data)
++next;
else
next = extra_data_since_last_finalize.erase(next);
}
else
{
++next;
}
}

/// Merge and deduplicate rhs' extra data
Expand Down

0 comments on commit 3ae578d

Please sign in to comment.