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

Implement arraySlice for arrays with aggregate function states. #9391

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions dbms/src/Columns/ColumnAggregateFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ void ColumnAggregateFunction::ensureOwnership()
}


bool ColumnAggregateFunction::structureEquals(const IColumn & to) const
{
const auto * to_concrete = typeid_cast<const ColumnAggregateFunction *>(&to);
if (!to_concrete)
return false;

/// AggregateFunctions must be the same.

const IAggregateFunction & func_this = *func;
const IAggregateFunction & func_to = *to_concrete->func;

return typeid(func_this) == typeid(func_to);
}


void ColumnAggregateFunction::insertRangeFrom(const IColumn & from, size_t start, size_t length)
{
const ColumnAggregateFunction & from_concrete = assert_cast<const ColumnAggregateFunction &>(from);
Expand Down
2 changes: 2 additions & 0 deletions dbms/src/Columns/ColumnAggregateFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class ColumnAggregateFunction final : public COWHelper<IColumn, ColumnAggregateF
}

void getExtremes(Field & min, Field & max) const override;

bool structureEquals(const IColumn &) const override;
};


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
['\0\0\0\0\0']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is also invisible character \x01.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select arraySlice(groupArray(x),1,1) as y from (select uniqState(number) as x from numbers(10) group by number);