mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix tests.
This commit is contained in:
parent
a58b152140
commit
819ea4fb89
@ -77,6 +77,7 @@ namespace ErrorCodes
|
||||
extern const int UNKNOWN_IDENTIFIER;
|
||||
extern const int ILLEGAL_PREWHERE;
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -103,14 +104,20 @@ bool allowEarlyConstantFolding(const ExpressionActions & actions, const Settings
|
||||
|
||||
}
|
||||
|
||||
bool sanitizeBlock(Block & block)
|
||||
bool sanitizeBlock(Block & block, bool throw_if_cannot_create_column)
|
||||
{
|
||||
for (auto & col : block)
|
||||
{
|
||||
if (!col.column)
|
||||
{
|
||||
if (isNotCreatable(col.type->getTypeId()))
|
||||
{
|
||||
if (throw_if_cannot_create_column)
|
||||
throw Exception("Cannot create column of type " + col.type->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
col.column = col.type->createColumn();
|
||||
}
|
||||
else if (!col.column->empty())
|
||||
|
@ -33,7 +33,7 @@ class ASTSelectQuery;
|
||||
struct ASTTablesInSelectQueryElement;
|
||||
|
||||
/// Create columns in block or return false if not possible
|
||||
bool sanitizeBlock(Block & block);
|
||||
bool sanitizeBlock(Block & block, bool throw_if_cannot_create_column = false);
|
||||
|
||||
/// ExpressionAnalyzer sources, intermediates and results. It splits data and logic, allows to test them separately.
|
||||
struct ExpressionAnalyzerData
|
||||
|
@ -451,7 +451,7 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
||||
/// Blocks used in expression analysis contains size 1 const columns for constant folding and
|
||||
/// null non-const columns to avoid useless memory allocations. However, a valid block sample
|
||||
/// requires all columns to be of size 0, thus we need to sanitize the block here.
|
||||
sanitizeBlock(result_header);
|
||||
sanitizeBlock(result_header, true);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user