mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
fix bug
This commit is contained in:
parent
71aa411746
commit
aeec4a62e7
@ -70,7 +70,7 @@ public:
|
||||
const DataTypeFunction * function_type = checkAndGetDataType<DataTypeFunction>(arguments[0].get());
|
||||
if (!function_type || function_type->getArgumentTypes().size() != 2)
|
||||
throw Exception("First argument for this overload of " + getName() + " must be a function with 2 arguments. Found "
|
||||
+ arguments[0]->getName() + " instead.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
+ arguments[0]->getName() + " instead.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
|
||||
arguments[0] = std::make_shared<DataTypeFunction>(nested_types);
|
||||
}
|
||||
@ -79,8 +79,8 @@ public:
|
||||
{
|
||||
if (arguments.size() != 2)
|
||||
throw Exception("Function " + getName() + " needs at least 2 argument; passed "
|
||||
+ toString(arguments.size()) + ".",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
+ toString(arguments.size()) + ".",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
const auto * data_type_function = checkAndGetDataType<DataTypeFunction>(arguments[0].type.get());
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace DB
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int ILLEGAL_COLUMN;
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
}
|
||||
|
||||
/** MapFilter(x -> predicate, array) - leave in the array only the elements for which the expression is true.
|
||||
@ -87,10 +88,14 @@ struct MapApplyImpl
|
||||
/// true if the expression (for an overload of f(expression, maps)) or a map (for f(map)) should be boolean.
|
||||
static bool needBoolean() { return false; }
|
||||
|
||||
static DataTypePtr getReturnType(const DataTypePtr & expression_return, const DataTypes & )
|
||||
static DataTypePtr getReturnType(const DataTypePtr & expression_return, const DataTypes & /*elems*/)
|
||||
{
|
||||
const auto * date_type_tuple = typeid_cast<const DataTypeTuple *>(&*expression_return);
|
||||
return std::make_shared<DataTypeMap>(date_type_tuple->getElements());
|
||||
const auto & tuple_types = typeid_cast<const DataTypeTuple *>(&*expression_return)->getElements();
|
||||
if (tuple_types.size() != 2)
|
||||
throw Exception("Expected 2 columns as map's key and value, but found "
|
||||
+ toString(tuple_types.size()) + " columns", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
return std::make_shared<DataTypeMap>(tuple_types);
|
||||
}
|
||||
|
||||
static ColumnPtr execute(const ColumnMap & map, ColumnPtr mapped)
|
||||
|
@ -9,4 +9,5 @@ SELECT mapApply((k,v)->(k,v+1), col) FROM table_map ORDER BY id;
|
||||
SELECT mapApply((x, y) -> (x, x + 1), map(1, 0, 2, 0));
|
||||
SELECT mapFilter((k,v)->0, col) from table_map;
|
||||
SELECT mapUpdate(map(1, 3, 3, 2), map(1, 0, 2, 0));
|
||||
SELECT mapApply((k, v) -> tuple(v + 9223372036854775806), col) FROM table_map; -- { serverError 42 }
|
||||
DROP TABLE table_map;
|
||||
|
Loading…
Reference in New Issue
Block a user