mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #7606 from amosbird/nullformat
Better Null format for tcp handler.
This commit is contained in:
commit
782e2f6c13
@ -530,7 +530,8 @@ void TCPHandler::processOrdinaryQuery()
|
|||||||
sendLogs();
|
sendLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendData(block);
|
if (!block || !state.io.null_format)
|
||||||
|
sendData(block);
|
||||||
if (!block)
|
if (!block)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ struct BlockIO
|
|||||||
std::function<void(IBlockInputStream *, IBlockOutputStream *)> finish_callback;
|
std::function<void(IBlockInputStream *, IBlockOutputStream *)> finish_callback;
|
||||||
std::function<void()> exception_callback;
|
std::function<void()> exception_callback;
|
||||||
|
|
||||||
|
/// When it is true, don't bother sending any non-empty blocks to the out stream
|
||||||
|
bool null_format = false;
|
||||||
|
|
||||||
/// Call these functions if you want to log the request.
|
/// Call these functions if you want to log the request.
|
||||||
void onFinish()
|
void onFinish()
|
||||||
{
|
{
|
||||||
|
@ -563,9 +563,18 @@ BlockIO executeQuery(
|
|||||||
bool may_have_embedded_data,
|
bool may_have_embedded_data,
|
||||||
bool allow_processors)
|
bool allow_processors)
|
||||||
{
|
{
|
||||||
|
ASTPtr ast;
|
||||||
BlockIO streams;
|
BlockIO streams;
|
||||||
std::tie(std::ignore, streams) = executeQueryImpl(query.data(), query.data() + query.size(), context,
|
std::tie(ast, streams) = executeQueryImpl(query.data(), query.data() + query.size(), context,
|
||||||
internal, stage, !may_have_embedded_data, nullptr, allow_processors);
|
internal, stage, !may_have_embedded_data, nullptr, allow_processors);
|
||||||
|
if (streams.in)
|
||||||
|
{
|
||||||
|
const auto * ast_query_with_output = dynamic_cast<const ASTQueryWithOutput *>(ast.get());
|
||||||
|
String format_name = ast_query_with_output && (ast_query_with_output->format != nullptr)
|
||||||
|
? getIdentifierName(ast_query_with_output->format) : context.getDefaultFormat();
|
||||||
|
if (format_name == "Null")
|
||||||
|
streams.null_format = true;
|
||||||
|
}
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user