Flush output format on each block in executeQuery

This commit is contained in:
Alexey Milovidov 2020-02-02 04:09:49 +03:00
parent 61d33a8d9a
commit cf6bbaeb97

View File

@ -689,19 +689,7 @@ void executeQuery(
if (set_result_details) if (set_result_details)
set_result_details(context.getClientInfo().current_query_id, out->getContentType(), format_name, DateLUT::instance().getTimeZone()); set_result_details(context.getClientInfo().current_query_id, out->getContentType(), format_name, DateLUT::instance().getTimeZone());
if (ast->as<ASTWatchQuery>()) copyData(*streams.in, *out, [](){ return false; }, [&out](const Block &) { out->flush(); });
{
/// For Watch query, flush data if block is empty (to send data to client).
auto flush_callback = [&out](const Block & block)
{
if (block.rows() == 0)
out->flush();
};
copyData(*streams.in, *out, [](){ return false; }, std::move(flush_callback));
}
else
copyData(*streams.in, *out);
} }
if (pipeline.initialized()) if (pipeline.initialized())