mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #48127 from ClickHouse/rs/sort-show
Sort output of SHOW <INFO> statements
This commit is contained in:
commit
47fd1ee06d
@ -12,7 +12,7 @@ namespace DB
|
||||
|
||||
BlockIO InterpreterShowEnginesQuery::execute()
|
||||
{
|
||||
return executeQuery("SELECT * FROM system.table_engines", getContext(), true);
|
||||
return executeQuery("SELECT * FROM system.table_engines ORDER BY name", getContext(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ InterpreterShowTablesQuery::InterpreterShowTablesQuery(const ASTPtr & query_ptr_
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
{
|
||||
const auto & query = query_ptr->as<ASTShowTablesQuery &>();
|
||||
@ -51,6 +50,9 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
if (query.limit_length)
|
||||
rewritten_query << " LIMIT " << query.limit_length;
|
||||
|
||||
/// (*)
|
||||
rewritten_query << " ORDER BY name";
|
||||
|
||||
return rewritten_query.str();
|
||||
}
|
||||
|
||||
@ -69,6 +71,9 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
<< DB::quote << query.like;
|
||||
}
|
||||
|
||||
/// (*)
|
||||
rewritten_query << " ORDER BY cluster";
|
||||
|
||||
if (query.limit_length)
|
||||
rewritten_query << " LIMIT " << query.limit_length;
|
||||
|
||||
@ -81,6 +86,9 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
|
||||
rewritten_query << " WHERE cluster = " << DB::quote << query.cluster_str;
|
||||
|
||||
/// (*)
|
||||
rewritten_query << " ORDER BY cluster";
|
||||
|
||||
return rewritten_query.str();
|
||||
}
|
||||
|
||||
@ -101,6 +109,9 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
<< DB::quote << query.like;
|
||||
}
|
||||
|
||||
/// (*)
|
||||
rewritten_query << " ORDER BY name, type, value ";
|
||||
|
||||
return rewritten_query.str();
|
||||
}
|
||||
|
||||
@ -146,6 +157,9 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
else if (query.where_expression)
|
||||
rewritten_query << " AND (" << query.where_expression << ")";
|
||||
|
||||
/// (*)
|
||||
rewritten_query << " ORDER BY name ";
|
||||
|
||||
if (query.limit_length)
|
||||
rewritten_query << " LIMIT " << query.limit_length;
|
||||
|
||||
@ -176,5 +190,8 @@ BlockIO InterpreterShowTablesQuery::execute()
|
||||
return executeQuery(getRewrittenQuery(), getContext(), true);
|
||||
}
|
||||
|
||||
/// (*) Sorting is strictly speaking not necessary but 1. it is convenient for users, 2. SQL currently does not allow to
|
||||
/// sort the output of SHOW <INFO> otherwise (SELECT * FROM (SHOW <INFO> ...) ORDER BY ...) is rejected) and 3. some
|
||||
/// SQL tests can take advantage of this.
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,6 @@ connect_timeout Seconds 10
|
||||
connect_timeout_with_failover_ms Milliseconds 2000
|
||||
connect_timeout_with_failover_secure_ms Milliseconds 3000
|
||||
external_storage_connect_timeout_sec UInt64 10
|
||||
filesystem_prefetch_max_memory_usage UInt64 1073741824
|
||||
max_untracked_memory UInt64 1048576
|
||||
memory_profiler_step UInt64 1048576
|
||||
filesystem_prefetch_max_memory_usage UInt64 1073741824
|
||||
|
Loading…
Reference in New Issue
Block a user