mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +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());
|
auto out = context.getOutputFormatProcessor(format_name, *out_buf, pipeline.getHeader());
|
||||||
|
out->setAutoFlush();
|
||||||
|
|
||||||
/// Save previous progress callback if any. TODO Do it more conveniently.
|
/// Save previous progress callback if any. TODO Do it more conveniently.
|
||||||
auto previous_progress_callback = context.getProgressCallback();
|
auto previous_progress_callback = context.getProgressCallback();
|
||||||
|
@ -69,6 +69,9 @@ void IOutputFormat::work()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto_flush)
|
||||||
|
flush();
|
||||||
|
|
||||||
has_input = false;
|
has_input = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ protected:
|
|||||||
bool finished = false;
|
bool finished = false;
|
||||||
bool finalized = 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;
|
RowsBeforeLimitCounterPtr rows_before_limit_counter;
|
||||||
|
|
||||||
virtual void consume(Chunk) = 0;
|
virtual void consume(Chunk) = 0;
|
||||||
@ -50,6 +53,8 @@ public:
|
|||||||
/// Flush output buffers if any.
|
/// Flush output buffers if any.
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
|
void setAutoFlush() { auto_flush = true; }
|
||||||
|
|
||||||
/// Value for rows_before_limit_at_least field.
|
/// Value for rows_before_limit_at_least field.
|
||||||
virtual void setRowsBeforeLimit(size_t /*rows_before_limit*/) {}
|
virtual void setRowsBeforeLimit(size_t /*rows_before_limit*/) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user