mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
More generic getInputOrderInfo() in query info
This commit is contained in:
parent
3e51933dd9
commit
fb5799fe7f
@ -142,7 +142,7 @@ ReadFromMergeTree::ReadFromMergeTree(
|
||||
output_stream->sort_mode = DataStream::SortMode::Chunk;
|
||||
|
||||
auto const& settings = context->getSettingsRef();
|
||||
if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order) && getInputOrderInfo(query_info))
|
||||
if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order) && query_info.getInputOrderInfo())
|
||||
output_stream->sort_mode = DataStream::SortMode::Port;
|
||||
}
|
||||
}
|
||||
@ -967,7 +967,7 @@ MergeTreeDataSelectAnalysisResultPtr ReadFromMergeTree::selectRangesToRead(
|
||||
result.total_marks_pk = total_marks_pk;
|
||||
result.selected_rows = sum_rows;
|
||||
|
||||
const auto & input_order_info = getInputOrderInfo(query_info);
|
||||
const auto & input_order_info = query_info.getInputOrderInfo();
|
||||
if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order) && input_order_info)
|
||||
result.read_type = (input_order_info->direction > 0) ? ReadType::InOrder
|
||||
: ReadType::InReverseOrder;
|
||||
@ -1058,7 +1058,7 @@ void ReadFromMergeTree::initializePipeline(QueryPipelineBuilder & pipeline, cons
|
||||
Pipe pipe;
|
||||
|
||||
const auto & settings = context->getSettingsRef();
|
||||
const auto & input_order_info = getInputOrderInfo(query_info);
|
||||
const auto & input_order_info = query_info.getInputOrderInfo();
|
||||
|
||||
if (select.final())
|
||||
{
|
||||
|
@ -141,14 +141,9 @@ public:
|
||||
void setQueryInfoInputOrderInfo(InputOrderInfoPtr order_info);
|
||||
|
||||
private:
|
||||
static InputOrderInfoPtr getInputOrderInfo(const SelectQueryInfo & query_info_)
|
||||
{
|
||||
return query_info_.input_order_info ? query_info_.input_order_info
|
||||
: (query_info_.projection ? query_info_.projection->input_order_info : nullptr);
|
||||
}
|
||||
int getSortDirection() const
|
||||
{
|
||||
const InputOrderInfoPtr & order_info = getInputOrderInfo(query_info);
|
||||
const InputOrderInfoPtr & order_info = query_info.getInputOrderInfo();
|
||||
if (order_info)
|
||||
return order_info->direction;
|
||||
|
||||
|
@ -191,6 +191,11 @@ struct SelectQueryInfo : SelectQueryInfoBase
|
||||
|
||||
/// Make subquery_for_sets reusable across different interpreters.
|
||||
SubqueriesForSets subquery_for_sets;
|
||||
|
||||
InputOrderInfoPtr getInputOrderInfo() const
|
||||
{
|
||||
return input_order_info ? input_order_info : (projection ? projection->input_order_info : nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user