mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Using std::shared_ptr for functions and AST [#METR-21503].
This commit is contained in:
parent
128f4a963c
commit
6d33959183
@ -1511,7 +1511,9 @@ class FunctionCast final : public IFunction
|
||||
WrapperType wrapper_function;
|
||||
std::function<Monotonicity(const IDataType &, const Field &, const Field &)> monotonicity_for_range;
|
||||
|
||||
public:
|
||||
FunctionCast(const Context & context) : context(context) {}
|
||||
private:
|
||||
|
||||
template <typename DataType> auto createWrapper(const DataTypePtr & from_type, const DataType * const)
|
||||
{
|
||||
@ -1637,7 +1639,7 @@ class FunctionCast final : public IFunction
|
||||
for (const auto & idx_type : ext::enumerate(from_type->getElements()))
|
||||
element_wrappers.push_back(prepare(idx_type.second, to_element_types[idx_type.first].get()));
|
||||
|
||||
std::shared_ptr<FunctionTuple> function_tuple{static_cast<FunctionTuple *>(FunctionTuple::create(context))};
|
||||
auto function_tuple = FunctionTuple::create(context);
|
||||
return [element_wrappers, function_tuple, from_element_types, to_element_types]
|
||||
(Block & block, const ColumnNumbers & arguments, const size_t result)
|
||||
{
|
||||
@ -1696,7 +1698,7 @@ class FunctionCast final : public IFunction
|
||||
return createStringToEnumWrapper<ColumnFixedString, EnumType>();
|
||||
else if (from_type->behavesAsNumber())
|
||||
{
|
||||
std::shared_ptr<Function> function{static_cast<Function *>(Function::create(context))};
|
||||
auto function = Function::create(context);
|
||||
|
||||
/// Check conversion using underlying function
|
||||
(void) function->getReturnType({ from_type });
|
||||
|
@ -50,7 +50,7 @@ AggregateFunctionPtr createAggregateFunctionQuantiles(const std::string & name,
|
||||
else if (typeid_cast<const DataTypeInt32 *>(&argument_type)) return std::make_shared<AggregateFunctionQuantiles<Int32>>();
|
||||
else if (typeid_cast<const DataTypeInt64 *>(&argument_type)) return std::make_shared<AggregateFunctionQuantiles<Int64>>();
|
||||
else if (typeid_cast<const DataTypeFloat32 *>(&argument_type)) return std::make_shared<AggregateFunctionQuantiles<Float32>>();
|
||||
else if (typeid_cast<const DataTypeFloat64 *>(&argument_type)) return std::make_shared<AggregateFunctionQuantiles<Float64>v;
|
||||
else if (typeid_cast<const DataTypeFloat64 *>(&argument_type)) return std::make_shared<AggregateFunctionQuantiles<Float64>>();
|
||||
else if (typeid_cast<const DataTypeDate *>(&argument_type))
|
||||
return std::make_shared<AggregateFunctionQuantiles<DataTypeDate::FieldType, false>>();
|
||||
else if (typeid_cast<const DataTypeDateTime*>(&argument_type))
|
||||
|
Loading…
Reference in New Issue
Block a user