Fix crash with untuple and unresolved lambda

This commit is contained in:
Raúl Marín 2024-04-30 13:36:20 +02:00
parent e6f97fd4c7
commit 10fb28c6ea
3 changed files with 5 additions and 0 deletions

View File

@ -5725,6 +5725,10 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
checkFunctionNodeHasEmptyNullsAction(function_node); checkFunctionNodeHasEmptyNullsAction(function_node);
const auto & untuple_argument = function_arguments[0]; const auto & untuple_argument = function_arguments[0];
/// Handle this special case first as `getResultType()` might return nullptr
if (untuple_argument->as<LambdaNode>())
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Function untuple can't have lambda-expressions as arguments");
auto result_type = untuple_argument->getResultType(); auto result_type = untuple_argument->getResultType();
const auto * tuple_data_type = typeid_cast<const DataTypeTuple *>(result_type.get()); const auto * tuple_data_type = typeid_cast<const DataTypeTuple *>(result_type.get());
if (!tuple_data_type) if (!tuple_data_type)

View File

@ -0,0 +1 @@
SELECT untuple(x -> 0) -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }