mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
70d1adfe4b
* save format string for NetException * format exceptions * format exceptions 2 * format exceptions 3 * format exceptions 4 * format exceptions 5 * format exceptions 6 * fix * format exceptions 7 * format exceptions 8 * Update MergeTreeIndexGin.cpp * Update AggregateFunctionMap.cpp * Update AggregateFunctionMap.cpp * fix
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
|
#include <Parsers/ASTFunction.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
|
}
|
|
|
|
inline bool functionIsInOperator(const std::string & name)
|
|
{
|
|
return name == "in" || name == "notIn" || name == "nullIn" || name == "notNullIn";
|
|
}
|
|
|
|
inline bool functionIsInOrGlobalInOperator(const std::string & name)
|
|
{
|
|
return functionIsInOperator(name) || name == "globalIn" || name == "globalNotIn" || name == "globalNullIn" || name == "globalNotNullIn";
|
|
}
|
|
|
|
inline bool functionIsLikeOperator(const std::string & name)
|
|
{
|
|
return name == "like" || name == "ilike" || name == "notLike" || name == "notILike";
|
|
}
|
|
|
|
inline bool functionIsJoinGet(const std::string & name)
|
|
{
|
|
return startsWith(name, "joinGet");
|
|
}
|
|
|
|
inline bool functionIsDictGet(const std::string & name)
|
|
{
|
|
return startsWith(name, "dictGet") || (name == "dictHas") || (name == "dictIsIn");
|
|
}
|
|
|
|
inline bool checkFunctionIsInOrGlobalInOperator(const ASTFunction & func)
|
|
{
|
|
if (functionIsInOrGlobalInOperator(func.name))
|
|
{
|
|
size_t num_arguments = func.arguments->children.size();
|
|
if (num_arguments != 2)
|
|
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
|
"Wrong number of arguments passed to function in. Expected: 2, passed: {}",
|
|
num_arguments);
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|