mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
Fixed tests
This commit is contained in:
parent
faaa1d8570
commit
d6c7c2193c
@ -63,7 +63,8 @@ ColumnsWithTypeAndName FunctionNode::getArgumentColumns() const
|
|||||||
else
|
else
|
||||||
argument_column.type = argument->getResultType();
|
argument_column.type = argument->getResultType();
|
||||||
|
|
||||||
if (auto * constant = argument->as<ConstantNode>())
|
auto * constant = argument->as<ConstantNode>();
|
||||||
|
if (constant && !isNotCreatable(argument_column.type))
|
||||||
argument_column.column = argument_column.type->createColumnConst(1, constant->getValue());
|
argument_column.column = argument_column.type->createColumnConst(1, constant->getValue());
|
||||||
|
|
||||||
argument_columns.push_back(std::move(argument_column));
|
argument_columns.push_back(std::move(argument_column));
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <Analyzer/ConstantNode.h>
|
#include <Analyzer/ConstantNode.h>
|
||||||
#include <Analyzer/HashUtils.h>
|
#include <Analyzer/HashUtils.h>
|
||||||
|
|
||||||
#include <DataTypes/DataTypeString.h>
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -100,6 +98,9 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (and_operands.size() == function_node.getArguments().getNodes().size())
|
||||||
|
return;
|
||||||
|
|
||||||
if (and_operands.size() == 1)
|
if (and_operands.size() == 1)
|
||||||
{
|
{
|
||||||
/// AND operator can have UInt8 or bool as its type.
|
/// AND operator can have UInt8 or bool as its type.
|
||||||
@ -207,6 +208,9 @@ private:
|
|||||||
or_operands.push_back(std::move(in_function));
|
or_operands.push_back(std::move(in_function));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (or_operands.size() == function_node.getArguments().getNodes().size())
|
||||||
|
return;
|
||||||
|
|
||||||
if (or_operands.size() == 1)
|
if (or_operands.size() == 1)
|
||||||
{
|
{
|
||||||
/// if the result type of operand is the same as the result type of OR
|
/// if the result type of operand is the same as the result type of OR
|
@ -6676,6 +6676,17 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
|||||||
|
|
||||||
/// Resolve query node sections.
|
/// Resolve query node sections.
|
||||||
|
|
||||||
|
NamesAndTypes projection_columns;
|
||||||
|
|
||||||
|
if (!scope.group_by_use_nulls)
|
||||||
|
{
|
||||||
|
projection_columns = resolveProjectionExpressionNodeList(query_node_typed.getProjectionNode(), scope);
|
||||||
|
if (query_node_typed.getProjection().getNodes().empty())
|
||||||
|
throw Exception(ErrorCodes::EMPTY_LIST_OF_COLUMNS_QUERIED,
|
||||||
|
"Empty list of columns in projection. In scope {}",
|
||||||
|
scope.scope_node->formatASTForErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
if (query_node_typed.hasWith())
|
if (query_node_typed.hasWith())
|
||||||
resolveExpressionNodeList(query_node_typed.getWithNode(), scope, true /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
resolveExpressionNodeList(query_node_typed.getWithNode(), scope, true /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
||||||
|
|
||||||
@ -6770,11 +6781,14 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
|||||||
convertLimitOffsetExpression(query_node_typed.getOffset(), "OFFSET", scope);
|
convertLimitOffsetExpression(query_node_typed.getOffset(), "OFFSET", scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto projection_columns = resolveProjectionExpressionNodeList(query_node_typed.getProjectionNode(), scope);
|
if (scope.group_by_use_nulls)
|
||||||
if (query_node_typed.getProjection().getNodes().empty())
|
{
|
||||||
throw Exception(ErrorCodes::EMPTY_LIST_OF_COLUMNS_QUERIED,
|
projection_columns = resolveProjectionExpressionNodeList(query_node_typed.getProjectionNode(), scope);
|
||||||
"Empty list of columns in projection. In scope {}",
|
if (query_node_typed.getProjection().getNodes().empty())
|
||||||
scope.scope_node->formatASTForErrorMessage());
|
throw Exception(ErrorCodes::EMPTY_LIST_OF_COLUMNS_QUERIED,
|
||||||
|
"Empty list of columns in projection. In scope {}",
|
||||||
|
scope.scope_node->formatASTForErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/** Resolve nodes with duplicate aliases.
|
/** Resolve nodes with duplicate aliases.
|
||||||
* Table expressions cannot have duplicate aliases.
|
* Table expressions cannot have duplicate aliases.
|
||||||
@ -6843,7 +6857,7 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
|||||||
|
|
||||||
for (const auto & column : projection_columns)
|
for (const auto & column : projection_columns)
|
||||||
{
|
{
|
||||||
if (isNotCreatable(column.type->getTypeId()))
|
if (isNotCreatable(column.type))
|
||||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||||
"Invalid projection column with type {}. In scope {}",
|
"Invalid projection column with type {}. In scope {}",
|
||||||
column.type->getName(),
|
column.type->getName(),
|
||||||
|
Loading…
Reference in New Issue
Block a user