mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 04:22:03 +00:00
Attempt to remove garbage
This commit is contained in:
parent
2d1351c3a6
commit
99d90a1430
@ -20,8 +20,19 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
struct hash<DB::DecimalField<T>>
|
||||||
|
{
|
||||||
|
size_t operator()(const DB::DecimalField<T> & x) const { return hash<T>()(x.getValue()); }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Settings;
|
struct Settings;
|
||||||
|
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
@ -65,7 +76,7 @@ struct AggregateFunctionMapData
|
|||||||
|
|
||||||
template <typename T, typename Derived, typename Visitor, bool overflow, bool tuple_argument, bool compact>
|
template <typename T, typename Derived, typename Visitor, bool overflow, bool tuple_argument, bool compact>
|
||||||
class AggregateFunctionMapBase : public IAggregateFunctionDataHelper<
|
class AggregateFunctionMapBase : public IAggregateFunctionDataHelper<
|
||||||
AggregateFunctionMapData<NearestFieldType<T>>, Derived>
|
AggregateFunctionMapData<T>, Derived>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static constexpr auto STATE_VERSION_1_MIN_REVISION = 54452;
|
static constexpr auto STATE_VERSION_1_MIN_REVISION = 54452;
|
||||||
@ -78,7 +89,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
using Base = IAggregateFunctionDataHelper<
|
using Base = IAggregateFunctionDataHelper<
|
||||||
AggregateFunctionMapData<NearestFieldType<T>>, Derived>;
|
AggregateFunctionMapData<T>, Derived>;
|
||||||
|
|
||||||
AggregateFunctionMapBase(const DataTypePtr & keys_type_,
|
AggregateFunctionMapBase(const DataTypePtr & keys_type_,
|
||||||
const DataTypes & values_types_, const DataTypes & argument_types_)
|
const DataTypes & values_types_, const DataTypes & argument_types_)
|
||||||
@ -227,14 +238,6 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
decltype(merged_maps.begin()) it;
|
decltype(merged_maps.begin()) it;
|
||||||
if constexpr (is_decimal<T>)
|
|
||||||
{
|
|
||||||
// FIXME why is storing NearestFieldType not enough, and we
|
|
||||||
// have to check for decimals again here?
|
|
||||||
UInt32 scale = static_cast<const ColumnDecimal<T> &>(key_column).getScale();
|
|
||||||
it = merged_maps.find(DecimalField<T>(key, scale));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
it = merged_maps.find(key);
|
it = merged_maps.find(key);
|
||||||
|
|
||||||
if (it != merged_maps.end())
|
if (it != merged_maps.end())
|
||||||
@ -254,19 +257,11 @@ public:
|
|||||||
new_values.resize(size);
|
new_values.resize(size);
|
||||||
new_values[col] = value;
|
new_values[col] = value;
|
||||||
|
|
||||||
if constexpr (is_decimal<T>)
|
|
||||||
{
|
|
||||||
UInt32 scale = static_cast<const ColumnDecimal<T> &>(key_column).getScale();
|
|
||||||
merged_maps.emplace(DecimalField<T>(key, scale), std::move(new_values));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
merged_maps.emplace(key, std::move(new_values));
|
merged_maps.emplace(key, std::move(new_values));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena *) const override
|
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||||
{
|
{
|
||||||
@ -354,9 +349,6 @@ public:
|
|||||||
for (size_t col = 0; col < values_types.size(); ++col)
|
for (size_t col = 0; col < values_types.size(); ++col)
|
||||||
deserialize(col, values);
|
deserialize(col, values);
|
||||||
|
|
||||||
if constexpr (is_decimal<T>)
|
|
||||||
merged_maps[key.get<DecimalField<T>>()] = values;
|
|
||||||
else
|
|
||||||
merged_maps[key.get<T>()] = values;
|
merged_maps[key.get<T>()] = values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -754,8 +746,8 @@ struct SumMapVariants
|
|||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using F = std::conditional_t<filtered,
|
using F = std::conditional_t<filtered,
|
||||||
AggregateFunctionSumMapFiltered<T, overflow, tuple_argument>,
|
AggregateFunctionSumMapFiltered<NearestFieldType<T>, overflow, tuple_argument>,
|
||||||
AggregateFunctionSumMap<T, overflow, tuple_argument>>;
|
AggregateFunctionSumMap<NearestFieldType<T>, overflow, tuple_argument>>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -765,7 +757,7 @@ template <bool tuple_argument>
|
|||||||
struct MinMapDispatchOnTupleArgument
|
struct MinMapDispatchOnTupleArgument
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using F = AggregateFunctionMinMap<T, tuple_argument>;
|
using F = AggregateFunctionMinMap<NearestFieldType<T>, tuple_argument>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This template gives an aggregate function template that is narrowed
|
// This template gives an aggregate function template that is narrowed
|
||||||
@ -774,7 +766,7 @@ template <bool tuple_argument>
|
|||||||
struct MaxMapDispatchOnTupleArgument
|
struct MaxMapDispatchOnTupleArgument
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using F = AggregateFunctionMaxMap<T, tuple_argument>;
|
using F = AggregateFunctionMaxMap<NearestFieldType<T>, tuple_argument>;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user