Merge pull request #63293 from ClickHouse/backport/24.3/63131

Backport #63131 to 24.3: Fix crash with untuple and unresolved lambda
This commit is contained in:
Raúl Marín 2024-05-03 11:21:28 +02:00 committed by GitHub
commit ca2ab86412
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View File

@ -5729,6 +5729,10 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
checkFunctionNodeHasEmptyNullsAction(function_node);
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();
const auto * tuple_data_type = typeid_cast<const DataTypeTuple *>(result_type.get());
if (!tuple_data_type)

View File

@ -0,0 +1,2 @@
SET allow_experimental_analyzer=1;
SELECT untuple(x -> 0) -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }