Skip to content

Commit eb17e17

Browse files
authored
Disable backfill sorting by default (#476)
1 parent 037555c commit eb17e17

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Core/Settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,8 @@ static constexpr UInt64 operator""_GiB(unsigned long long value)
790790
M(UInt64, keep_windows, 0, "How many streaming windows to keep from recycling", 0) \
791791
M(String, seek_to, "", "Seeking to an offset of the streaming/historical store to seek", 0) \
792792
M(Bool, enable_backfill_from_historical_store, true, "Enable backfill data from historical data store", 0) \
793-
M(Bool, emit_aggregated_during_backfill, true, "Enable emit intermediate aggr result during backfill historical data", 0) \
793+
M(Bool, emit_aggregated_during_backfill, false, "Enable emit intermediate aggr result during backfill historical data", 0) \
794+
M(Bool, force_backfill_in_order, false, "Requires backfill data in order", 0) \
794795
M(Bool, include_internal_streams, false, "Show internal streams on SHOW streams query.", 0) \
795796
M(UInt64, join_max_buffered_bytes, 524288000, "Max buffered bytes for stream to stream join", 0) \
796797
M(UInt64, join_buffered_data_block_size, 0, "For streaming join, when buffered data in memory, the data block size directs to merge small data blocks to form bigger ones to improve memory efficiency. 0 means disable merging small data blocks.", 0) \

src/Interpreters/InterpreterSelectQuery.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3434,9 +3434,11 @@ void InterpreterSelectQuery::finalCheckAndOptimizeForStreamingQuery()
34343434
context->setSetting("enable_backfill_from_historical_store", false);
34353435
}
34363436

3437-
/// Optimization: no requires backfill data in order for global aggregation with settings `emit_aggregated_during_backfill = false`.
3438-
if (!settings.emit_aggregated_during_backfill.value && hasStreamingGlobalAggregation())
3439-
query_info.require_in_order_backfill = false;
3437+
/// Usually, we don't care whether the backfilled data is in order. Excepts:
3438+
/// 1) User require backfill data in order
3439+
/// 2) User need window aggr emit result during backfill (it expects that process data in ascending event time)
3440+
if (settings.force_backfill_in_order.value || (settings.emit_aggregated_during_backfill.value && hasAggregation() && hasStreamingWindowFunc()))
3441+
query_info.require_in_order_backfill = true;
34403442
}
34413443
else
34423444
{

src/Storages/SelectQueryInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ struct SelectQueryInfo
184184
SeekToInfoPtr seek_to_info_of_right_stream; /// Rewind info for right streaming store in streaming query
185185

186186
/// if is true, means need sort backfill input by event time (ascending)
187-
bool require_in_order_backfill = true;
187+
bool require_in_order_backfill = false;
188188

189189
Streaming::WindowParamsPtr streaming_window_params;
190190

0 commit comments

Comments
 (0)