mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #11846 from ClickHouse/prohibit-array-join-in-higher-order-functions
Don't allow arrayJoin inside higher order functions
This commit is contained in:
commit
dd31bcff66
@ -8,11 +8,13 @@
|
||||
#include <Columns/ColumnFunction.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
class ExecutableFunctionExpression : public IExecutableFunctionImpl
|
||||
@ -203,6 +205,11 @@ public:
|
||||
const String & expression_return_name_)
|
||||
: expression_actions(std::move(expression_actions_))
|
||||
{
|
||||
/// Check that expression does not contain unusual actions that will break blocks structure.
|
||||
for (const auto & action : expression_actions->getActions())
|
||||
if (action.type == ExpressionAction::Type::JOIN || action.type == ExpressionAction::Type::ARRAY_JOIN)
|
||||
throw Exception("Expression with arrayJoin or other unusual action cannot be captured", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
std::unordered_map<std::string, DataTypePtr> arguments_map;
|
||||
|
||||
const auto & all_arguments = expression_actions->getRequiredColumnsWithTypes();
|
||||
|
@ -33,7 +33,8 @@ namespace ErrorCodes
|
||||
* arrayMap(x1,...,xn -> expression, array1,...,arrayn) - apply the expression to each element of the array (or set of parallel arrays).
|
||||
* arrayFilter(x -> predicate, array) - leave in the array only the elements for which the expression is true.
|
||||
*
|
||||
* For some functions arrayCount, arrayExists, arrayAll, an overload of the form f(array) is available, which works in the same way as f(x -> x, array).
|
||||
* For some functions arrayCount, arrayExists, arrayAll, an overload of the form f(array) is available,
|
||||
* which works in the same way as f(x -> x, array).
|
||||
*
|
||||
* See the example of Impl template parameter in arrayMap.cpp
|
||||
*/
|
||||
|
@ -0,0 +1 @@
|
||||
SELECT arrayMap(x -> arrayJoin([x, 1]), [1, 2]); -- { serverError 36 }
|
Loading…
Reference in New Issue
Block a user