mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
support SHOW CHANGED SETTINGS query and add test cases, also do code changes to compile SHOW SETTINGS PROFILES.
This commit is contained in:
parent
f829fbb928
commit
508b50d121
@ -85,10 +85,13 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
WriteBufferFromOwnString rewritten_query;
|
||||
rewritten_query << "SELECT name, type, value FROM system.settings";
|
||||
|
||||
if (query.changed)
|
||||
rewritten_query << " WHERE changed = 1";
|
||||
|
||||
if (!query.like.empty())
|
||||
{
|
||||
rewritten_query
|
||||
<< " WHERE name "
|
||||
<< (query.changed ? " AND name " : " WHERE name ")
|
||||
<< (query.case_insensitive_like ? "ILIKE " : "LIKE ")
|
||||
<< DB::quote << query.like;
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ void ASTShowTablesQuery::formatQueryImpl(const FormatSettings & settings, Format
|
||||
}
|
||||
else if (m_settings)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW SETTINGS" << (settings.hilite ? hilite_none : "");
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW " << (changed ? "CHANGED " : "") << "SETTINGS" <<
|
||||
(settings.hilite ? hilite_none : "");
|
||||
formatLike(settings);
|
||||
}
|
||||
else
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
bool cluster{false};
|
||||
bool dictionaries{false};
|
||||
bool m_settings{false};
|
||||
bool changed{false};
|
||||
bool temporary{false};
|
||||
|
||||
String cluster_str;
|
||||
|
@ -25,6 +25,7 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
ParserKeyword s_cluster("CLUSTER");
|
||||
ParserKeyword s_dictionaries("DICTIONARIES");
|
||||
ParserKeyword s_settings("SETTINGS");
|
||||
ParserKeyword s_changed("CHANGED");
|
||||
ParserKeyword s_from("FROM");
|
||||
ParserKeyword s_in("IN");
|
||||
ParserKeyword s_not("NOT");
|
||||
@ -100,11 +101,19 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
|
||||
query->cluster_str = std::move(cluster_str);
|
||||
}
|
||||
else if (s_settings.ignore(pos))
|
||||
else if (bool changed = s_changed.ignore(pos); changed || s_settings.ignore(pos))
|
||||
{
|
||||
query->m_settings = true;
|
||||
|
||||
if (bool insensitive = s_ilike.ignore(pos, expected); insensitive || s_like.ignore(pos, expected))
|
||||
if (changed)
|
||||
{
|
||||
query->changed = true;
|
||||
if (!s_settings.ignore(pos, expected))
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Not expected due to "SHOW SETTINGS PROFILES"
|
||||
if (bool insensitive = s_ilike.ignore(pos); insensitive || s_like.ignore(pos))
|
||||
{
|
||||
if (insensitive)
|
||||
query->case_insensitive_like = true;
|
||||
@ -112,6 +121,8 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
if (!like_p.parse(pos, like, expected))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1 +1,12 @@
|
||||
send_timeout Seconds 300
|
||||
insert_in_memory_parts_timeout Milliseconds 600000
|
||||
distributed_aggregation_memory_efficient Bool 0
|
||||
aggregation_memory_efficient_merge_threads UInt64 0
|
||||
memory_tracker_fault_probability Float 0
|
||||
max_memory_usage UInt64 10000000000
|
||||
max_memory_usage_for_user UInt64 0
|
||||
max_untracked_memory UInt64 4194304
|
||||
memory_profiler_step UInt64 0
|
||||
memory_profiler_sample_probability Float 0
|
||||
max_memory_usage_for_all_queries UInt64 0
|
||||
max_memory_usage UInt64 10000000000
|
||||
|
@ -1 +1,5 @@
|
||||
show settings like 'send_timeout';
|
||||
SHOW SETTINGS ILIKE '%MEMORY%';
|
||||
SHOW CHANGED SETTINGS ILIKE '%MEMORY%';
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user