mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Better comments
This commit is contained in:
parent
1ac81c99db
commit
c3c56e3dc5
@ -5,6 +5,8 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// Special adapter classes that implement functions execution with Dynamic arguments.
|
||||
|
||||
class ExecutableFunctionDynamicAdaptor final : public IExecutableFunction
|
||||
{
|
||||
public:
|
||||
@ -31,6 +33,7 @@ protected:
|
||||
private:
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count, bool dry_run) const;
|
||||
|
||||
/// We remember the original IFunctionOverloadResolver to be able to build function for types inside Dynamic column.
|
||||
std::shared_ptr<const IFunctionOverloadResolver> function_overload_resolver;
|
||||
size_t dynamic_argument_index;
|
||||
};
|
||||
@ -65,6 +68,7 @@ public:
|
||||
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo &) const override { return true; }
|
||||
|
||||
private:
|
||||
/// We remember the original IFunctionOverloadResolver to be able to build function for types inside Dynamic column.
|
||||
std::shared_ptr<const IFunctionOverloadResolver> function_overload_resolver;
|
||||
DataTypes arguments;
|
||||
DataTypePtr return_type;
|
||||
|
@ -450,6 +450,7 @@ DataTypePtr IFunctionOverloadResolver::getReturnType(const ColumnsWithTypeAndNam
|
||||
|
||||
FunctionBasePtr IFunctionOverloadResolver::build(const ColumnsWithTypeAndName & arguments) const
|
||||
{
|
||||
/// Use FunctionBaseDynamicAdaptor if default implementation for Dynamic is enabled and we have Dynamic type in arguments.
|
||||
if (useDefaultImplementationForDynamic())
|
||||
{
|
||||
for (const auto & arg : arguments)
|
||||
|
@ -371,6 +371,8 @@ public:
|
||||
/// (for functions like isNull(x))
|
||||
virtual ColumnNumbers getArgumentsThatDontImplyNullableReturnType(size_t number_of_arguments [[maybe_unused]]) const { return {}; }
|
||||
|
||||
/// Returns type that should be used as the result type in default implementation for Dynamic.
|
||||
/// Function should implement this method if its result type doesn't depend on the arguments types.
|
||||
virtual DataTypePtr getReturnTypeForDefaultImplementationForDynamic() const { return nullptr; }
|
||||
|
||||
protected:
|
||||
@ -427,6 +429,15 @@ protected:
|
||||
/// If it isn't, will convert all ColumnLowCardinality arguments to full columns.
|
||||
virtual bool canBeExecutedOnLowCardinalityDictionary() const { return true; }
|
||||
|
||||
/** If useDefaultImplementationForDynamic() is true, then special FunctionBaseDynamicAdaptor will be used
|
||||
* if function arguments has Dynamic column. This adaptor will build and execute this function for all
|
||||
* internal types inside Dynamic column separately and construct result based on results for these types.
|
||||
* If getReturnTypeForDefaultImplementationForDynamic() returns T, then result of such function
|
||||
* will be Nullable(T), otherwise the result will be Dynamic.
|
||||
*
|
||||
* We cannot use default implementation for Dynamic if function doesn't use default implementation for NULLs,
|
||||
* because Dynamic column can contain NULLs and we should know how to process them.
|
||||
*/
|
||||
virtual bool useDefaultImplementationForDynamic() const { return useDefaultImplementationForNulls(); }
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user