mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Adding support to auto set output_format_enable_streaming option
based on the query type.
This commit is contained in:
parent
de6d2d01b9
commit
4749122734
@ -92,6 +92,11 @@ static FormatSettings getOutputFormatSetting(const Settings & settings, const Co
|
||||
{
|
||||
FormatSettings format_settings;
|
||||
format_settings.enable_streaming = settings.output_format_enable_streaming;
|
||||
/// Check query context to see if streaming mode was auto set based on the query type
|
||||
if (context.hasQueryContext())
|
||||
{
|
||||
format_settings.enable_streaming |= context.getQueryContext().getSettings().output_format_enable_streaming;
|
||||
}
|
||||
format_settings.json.quote_64bit_integers = settings.output_format_json_quote_64bit_integers;
|
||||
format_settings.json.quote_denormals = settings.output_format_json_quote_denormals;
|
||||
format_settings.json.escape_forward_slashes = settings.output_format_json_escape_forward_slashes;
|
||||
|
@ -180,6 +180,20 @@ static void onExceptionBeforeStart(const String & query_for_logging, Context & c
|
||||
query_log->add(elem);
|
||||
}
|
||||
|
||||
static void setQuerySpecificSettings(ASTPtr & ast, Context & context)
|
||||
{
|
||||
if (auto * ast_insert_into = dynamic_cast<ASTInsertQuery *>(ast.get()))
|
||||
{
|
||||
if (ast_insert_into->watch)
|
||||
{
|
||||
if (context.hasQueryContext())
|
||||
{
|
||||
Context & query_context = const_cast<Context &>(context).getQueryContext();
|
||||
query_context.setSetting("output_format_enable_streaming", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
|
||||
const char * begin,
|
||||
@ -246,6 +260,8 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
|
||||
throw;
|
||||
}
|
||||
|
||||
setQuerySpecificSettings(ast, context);
|
||||
|
||||
/// Copy query into string. It will be written to log and presented in processlist. If an INSERT query, string will not include data to insertion.
|
||||
String query(begin, query_end);
|
||||
BlockIO res;
|
||||
@ -637,6 +653,7 @@ void executeQuery(
|
||||
ASTPtr ast;
|
||||
BlockIO streams;
|
||||
|
||||
|
||||
std::tie(ast, streams) = executeQueryImpl(begin, end, context, false, QueryProcessingStage::Complete, may_have_tail, &istr, true);
|
||||
|
||||
auto & pipeline = streams.pipeline;
|
||||
|
@ -27,9 +27,6 @@ try:
|
||||
client1.send('SET allow_experimental_live_view = 1')
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send('SET output_format_enable_streaming = 1')
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send('DROP TABLE IF EXISTS test.lv')
|
||||
client1.expect(prompt)
|
||||
client1.send('DROP TABLE IF EXISTS test.mt')
|
||||
|
Loading…
Reference in New Issue
Block a user