mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Flush output for interactive applications
This commit is contained in:
parent
cf6bbaeb97
commit
5262512f0c
@ -721,6 +721,7 @@ void executeQuery(
|
||||
});
|
||||
|
||||
auto out = context.getOutputFormatProcessor(format_name, *out_buf, pipeline.getHeader());
|
||||
out->setAutoFlush();
|
||||
|
||||
/// Save previous progress callback if any. TODO Do it more conveniently.
|
||||
auto previous_progress_callback = context.getProgressCallback();
|
||||
|
@ -69,6 +69,9 @@ void IOutputFormat::work()
|
||||
break;
|
||||
}
|
||||
|
||||
if (auto_flush)
|
||||
flush();
|
||||
|
||||
has_input = false;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,9 @@ protected:
|
||||
bool finished = false;
|
||||
bool finalized = false;
|
||||
|
||||
/// Flush data on each consumed chunk. This is intented for interactive applications to output data as soon as it's ready.
|
||||
bool auto_flush = false;
|
||||
|
||||
RowsBeforeLimitCounterPtr rows_before_limit_counter;
|
||||
|
||||
virtual void consume(Chunk) = 0;
|
||||
@ -50,6 +53,8 @@ public:
|
||||
/// Flush output buffers if any.
|
||||
virtual void flush();
|
||||
|
||||
void setAutoFlush() { auto_flush = true; }
|
||||
|
||||
/// Value for rows_before_limit_at_least field.
|
||||
virtual void setRowsBeforeLimit(size_t /*rows_before_limit*/) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user