This commit is contained in:
Alexander Tokmakov 2021-07-01 19:43:59 +03:00
parent d9a77e3a1a
commit 1b2416007e
2 changed files with 30 additions and 22 deletions

View File

@ -77,6 +77,7 @@ namespace ErrorCodes
{
extern const int INTO_OUTFILE_NOT_ALLOWED;
extern const int QUERY_WAS_CANCELLED;
extern const int LOGICAL_ERROR;
}
@ -1059,12 +1060,6 @@ void executeQuery(
copyData(*streams.in, *out, [](){ return false; }, [&out](const Block &) { out->flush(); });
}
else if (pipeline.initialized())
{
if (pipeline.isCompleted())
{
pipeline.setProgressCallback(context->getProgressCallback());
}
else
{
const ASTQueryWithOutput * ast_query_with_output = dynamic_cast<const ASTQueryWithOutput *>(ast.get());
@ -1084,6 +1079,8 @@ void executeQuery(
? getIdentifierName(ast_query_with_output->format)
: context->getDefaultFormat();
if (!pipeline.isCompleted())
{
pipeline.addSimpleTransform([](const Block & header)
{
return std::make_shared<MaterializingTransform>(header);
@ -1109,6 +1106,10 @@ void executeQuery(
pipeline.setOutputFormat(std::move(out));
}
else
{
pipeline.setProgressCallback(context->getProgressCallback());
}
{
auto executor = pipeline.execute();

View File

@ -1139,7 +1139,14 @@ ActionLock StorageDistributed::getActionLock(StorageActionBlockType type)
void StorageDistributed::flush()
{
try
{
flushClusterNodesAllData(getContext());
}
catch (...)
{
tryLogCurrentException(log, "Cannot flush");
}
}
void StorageDistributed::flushClusterNodesAllData(ContextPtr local_context)