Skip to content

Commit

Permalink
Another test
Browse files Browse the repository at this point in the history
  • Loading branch information
amosbird committed Aug 1, 2022
1 parent 5580209 commit 6934702
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/AggregateFunctions/AggregateFunctionArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class AggregateFunctionArray final : public IAggregateFunctionHelper<AggregateFu
return nested_func->getBaseAggregateFunctionWithSameStateRepresentation();
}

DataTypePtr getNormalizedStateType() const override
DataTypePtr getStateType() const override
{
return nested_func->getNormalizedStateType();
return nested_func->getStateType();
}

bool isVersioned() const override
Expand Down
4 changes: 2 additions & 2 deletions src/AggregateFunctions/AggregateFunctionCount.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class AggregateFunctionCount final : public IAggregateFunctionDataHelper<Aggrega
return this->getName() == rhs.getName();
}

DataTypePtr getNormalizedStateType() const override
DataTypePtr getStateType() const override
{
/// Return normalized state type: count()
AggregateFunctionProperties properties;
Expand Down Expand Up @@ -260,7 +260,7 @@ class AggregateFunctionCountNotNullUnary final
return this->getName() == rhs.getName();
}

DataTypePtr getNormalizedStateType() const override
DataTypePtr getStateType() const override
{
/// Return normalized state type: count()
AggregateFunctionProperties properties;
Expand Down
4 changes: 2 additions & 2 deletions src/AggregateFunctions/AggregateFunctionIf.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class AggregateFunctionIf final : public IAggregateFunctionHelper<AggregateFunct
return nested_func->getBaseAggregateFunctionWithSameStateRepresentation();
}

DataTypePtr getNormalizedStateType() const override
DataTypePtr getStateType() const override
{
return nested_func->getNormalizedStateType();
return nested_func->getStateType();
}

bool isVersioned() const override
Expand Down
2 changes: 1 addition & 1 deletion src/AggregateFunctions/AggregateFunctionQuantile.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class AggregateFunctionQuantile final
&& this->haveEqualArgumentTypes(rhs);
}

DataTypePtr getNormalizedStateType() const override
DataTypePtr getStateType() const override
{
/// Return normalized state type: quantiles*(1)(...)
Array params{1};
Expand Down
2 changes: 1 addition & 1 deletion src/AggregateFunctions/AggregateFunctionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AggregateFunctionState final : public IAggregateFunctionHelper<AggregateFu

DataTypePtr getReturnType() const override
{
return getNormalizedStateType();
return getStateType();
}

const IAggregateFunction & getBaseAggregateFunctionWithSameStateRepresentation() const override
Expand Down
3 changes: 0 additions & 3 deletions src/AggregateFunctions/IAggregateFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class IAggregateFunction : public std::enable_shared_from_this<IAggregateFunctio
/// Get the data type of internal state. By default it is AggregateFunction(name(params), argument_types...).
virtual DataTypePtr getStateType() const;

/// Same as the above but normalize state types so that variants with the same binary representation will use the same type.
virtual DataTypePtr getNormalizedStateType() const { return getStateType(); }

/// Returns true if two aggregate functions have the same state representation in memory and the same serialization,
/// so state of one aggregate function can be safely used with another.
/// Examples:
Expand Down
4 changes: 2 additions & 2 deletions src/DataTypes/DataTypeAggregateFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ bool DataTypeAggregateFunction::equals(const IDataType & rhs) const
if (typeid(rhs) != typeid(*this))
return false;

auto lhs_state_type = function->getNormalizedStateType();
auto rhs_state_type = typeid_cast<const DataTypeAggregateFunction &>(rhs).function->getNormalizedStateType();
auto lhs_state_type = function->getStateType();
auto rhs_state_type = typeid_cast<const DataTypeAggregateFunction &>(rhs).function->getStateType();

if (typeid(lhs_state_type.get()) != typeid(rhs_state_type.get()))
return false;
Expand Down

0 comments on commit 6934702

Please sign in to comment.