mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 20:42:04 +00:00
Fix some tests
This commit is contained in:
parent
6132b57beb
commit
b3d811a199
@ -1496,6 +1496,7 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo &
|
||||
|
||||
// in order to read blocks in fixed order
|
||||
query_info.do_not_steal_task = true;
|
||||
query_info.read_in_pk_order = true;
|
||||
if (order_direction == -1)
|
||||
{
|
||||
pipeline.transform([&](auto & stream)
|
||||
@ -1510,7 +1511,7 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo &
|
||||
settings.max_bytes_before_external_sort, context.getTemporaryPath());
|
||||
};
|
||||
|
||||
if (settings.optimize_pk_order && !query.groupBy())
|
||||
if (settings.optimize_pk_order && !query.groupBy() && !order_descr.empty())
|
||||
{
|
||||
if (const auto * merge_tree = dynamic_cast<const MergeTreeData *>(storage.get()))
|
||||
{
|
||||
|
@ -587,7 +587,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::readFromParts(
|
||||
virt_column_names,
|
||||
settings);
|
||||
}
|
||||
else if (settings.optimize_pk_order)
|
||||
else if (settings.optimize_pk_order && query_info.read_in_pk_order)
|
||||
{
|
||||
std::vector<String> add_columns = data.sorting_key_expr->getRequiredColumns();
|
||||
column_names_to_read.insert(column_names_to_read.end(), add_columns.begin(), add_columns.end());
|
||||
|
@ -54,6 +54,7 @@ struct SelectQueryInfo
|
||||
/// If set to true, the query from MergeTree will return a set of streams,
|
||||
/// each of them will read data in sorted by sorting key order.
|
||||
bool do_not_steal_task = false;
|
||||
bool read_in_pk_order = false;
|
||||
|
||||
/// Prepared sets are used for indices by storage engine.
|
||||
/// Example: x IN (1, 2, 3)
|
||||
|
Loading…
Reference in New Issue
Block a user