Using std::shared_ptr for functions and AST [#METR-21503].

This commit is contained in:
Alexey Milovidov 2016-05-28 19:00:04 +03:00
parent e336ba10eb
commit 36efb7063e
2 changed files with 13 additions and 13 deletions

View File

@ -269,16 +269,16 @@ bool ParserBetweenExpression::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos &
return false;
/// функция AND
std::unique_ptr<ASTFunction> f_and = std::make_unique<ASTFunction>();
std::unique_ptr<ASTExpressionList> args_and = std::make_unique<ASTExpressionList>();
auto f_and = std::make_shared<ASTFunction>();
auto args_and = std::make_shared<ASTExpressionList>();
/// >=
std::unique_ptr<ASTFunction> f_ge = std::make_unique<ASTFunction>();
std::unique_ptr<ASTExpressionList> args_ge = std::make_unique<ASTExpressionList>();
auto f_ge = std::make_shared<ASTFunction>();
auto args_ge = std::make_shared<ASTExpressionList>();
/// <=
std::unique_ptr<ASTFunction> f_le = std::make_unique<ASTFunction>();
std::unique_ptr<ASTExpressionList> args_le = std::make_unique<ASTExpressionList>();
auto f_le = std::make_shared<ASTFunction>();
auto args_le = std::make_shared<ASTExpressionList>();
args_ge->children.emplace_back(subject);
args_ge->children.emplace_back(left);
@ -289,25 +289,25 @@ bool ParserBetweenExpression::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos &
f_ge->range.first = begin;
f_ge->range.second = pos;
f_ge->name = "greaterOrEquals";
f_ge->arguments = args_ge.release();
f_ge->arguments = args_ge;
f_ge->children.emplace_back(f_ge->arguments);
f_le->range.first = begin;
f_le->range.second = pos;
f_le->name = "lessOrEquals";
f_le->arguments = args_le.release();
f_le->arguments = args_le;
f_le->children.emplace_back(f_le->arguments);
args_and->children.emplace_back(f_ge.release());
args_and->children.emplace_back(f_le.release());
args_and->children.emplace_back(f_ge);
args_and->children.emplace_back(f_le);
f_and->range.first = begin;
f_and->range.second = pos;
f_and->name = "and";
f_and->arguments = args_and.release();
f_and->arguments = args_and;
f_and->children.emplace_back(f_and->arguments);
node = f_and.release();
node = f_and;
}
return true;

View File

@ -3269,7 +3269,7 @@ void StorageReplicatedMergeTree::reshardPartitions(ASTPtr query, const String &
if (!resharding_worker.isStarted())
throw Exception{"Resharding background thread is not running", ErrorCodes::RESHARDING_NO_WORKER};
bool has_coordinator = coordinator != nullptr;
bool has_coordinator = !coordinator.isNull();
std::string coordinator_id;
UInt64 block_number = 0;