提交 f8cb28cf 编写于 作者: A Alexey Arno

Apply required fixes [#METR-14099].

上级 e7301a40
......@@ -125,9 +125,6 @@ typedef std::list<Block> BlocksList;
/// Сравнить типы столбцов у блоков. Порядок столбцов имеет значение. Имена не имеют значения.
bool blocksHaveEqualStructure(const Block & lhs, const Block & rhs);
/// Проверить, что типы столбцов у блоков совместимые. Порядок имеет значение. Имена не имеют значения.
bool blocksHaveCompatibleStructure(const Block& lhs, const Block& rhs);
}
namespace std
......
......@@ -29,8 +29,6 @@ public:
{
return "FixedString(" + toString(n) + ")";
}
bool behavesAsString() const { return true; }
DataTypePtr clone() const
{
......
......@@ -22,8 +22,6 @@ public:
{
return "String";
}
bool behavesAsString() const { return true; }
DataTypePtr clone() const
{
......
......@@ -31,9 +31,6 @@ public:
/// true для чисел, false для даты и даты-с-временем.
virtual bool behavesAsNumber() const { return false; }
/// Является ли тип строковым.
virtual bool behavesAsString() const { return false; }
/// Клонировать
virtual SharedPtr<IDataType> clone() const = 0;
......
......@@ -16,24 +16,6 @@
#include <DB/Parsers/formatAST.h>
namespace
{
bool typesAreCompatible(const DB::IDataType & lhs, const DB::IDataType & rhs)
{
if (lhs.behavesAsNumber() && rhs.behavesAsNumber())
return true;
if (lhs.behavesAsString() && rhs.behavesAsString())
return true;
if (lhs.getName() == rhs.getName())
return true;
return false;
}
}
namespace DB
{
......@@ -389,23 +371,6 @@ bool blocksHaveEqualStructure(const Block & lhs, const Block & rhs)
return true;
}
bool blocksHaveCompatibleStructure(const Block & lhs, const Block & rhs)
{
size_t columns = lhs.columns();
if (rhs.columns() != columns)
return false;
for (size_t i = 0; i < columns; ++i)
{
const IDataType & lhs_type = *lhs.getByPosition(i).type;
const IDataType & rhs_type = *rhs.getByPosition(i).type;
if (!typesAreCompatible(lhs_type, rhs_type))
return false;
}
return true;
}
void Block::clear()
{
......
......@@ -38,7 +38,8 @@ bool ParserSelectQuery::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected &
ParserString s_order("ORDER", true, true);
ParserString s_limit("LIMIT", true, true);
ParserString s_format("FORMAT", true, true);
ParserString s_union_all("UNION ALL", true, true);
ParserString s_union("UNION", true, true);
ParserString s_all("ALL", true, true);
ParserNotEmptyExpressionList exp_list;
ParserExpressionWithOptionalAlias exp_elem;
......@@ -291,17 +292,22 @@ bool ParserSelectQuery::parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected &
}
// UNION ALL select query
if (s_union_all.ignore(pos, end, expected))
if (s_union.ignore(pos, end, expected))
{
ws.ignore(pos, end);
ParserSelectQuery select_p;
if (!select_p.parse(pos, end, select_query->next_union_all, expected))
if (s_all.ignore(pos, end, expected))
{
ParserSelectQuery select_p;
if (!select_p.parse(pos, end, select_query->next_union_all, expected))
return false;
}
else
return false;
ws.ignore(pos, end);
}
select_query->children.push_back(select_query->select_expression_list);
if (select_query->database)
select_query->children.push_back(select_query->database);
......
......@@ -239,7 +239,7 @@ void formatAST(const ASTSelectQuery & ast, std::ostream & s, size_t indent, bo
formatAST(*ast.format, s, indent, hilite, one_line);
}
if (!ast.next_union_all.isNull())
if (ast.next_union_all)
{
s << (hilite ? hilite_keyword : "") << nl_or_ws << indent_str << "UNION ALL " << nl_or_ws << (hilite ? hilite_none : "");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册