Skip to content

Commit

Permalink
Merge pull request #59605 from Algunenano/more_sanity_checks
Browse files Browse the repository at this point in the history
Add another sanity check for function return types
  • Loading branch information
Algunenano committed Feb 7, 2024
2 parents 01a459c + e10e105 commit 05e33bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Analyzer/Passes/QueryAnalysisPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5664,6 +5664,14 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
column = function_base->getConstantResultForNonConstArguments(argument_columns, result_type);
}

if (column && column->getDataType() != result_type->getColumnType())
throw Exception(
ErrorCodes::LOGICAL_ERROR,
"Unexpected return type from {}. Expected {}. Got {}",
function->getName(),
result_type->getColumnType(),
column->getDataType());

/** Do not perform constant folding if there are aggregate or arrayJoin functions inside function.
* Example: SELECT toTypeName(sum(number)) FROM numbers(10);
*/
Expand Down

0 comments on commit 05e33bd

Please sign in to comment.