Merge pull request #51822 from kssenii/minor-changes

Follow up to #51547
This commit is contained in:
Kseniia Sumarokova 2023-07-06 12:10:50 +02:00 committed by GitHub
commit 5ac85f4fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 22 deletions

View File

@ -11,16 +11,7 @@
namespace DB namespace DB
{ {
///
/// -------- Column --------- Type ------
/// | event_date | DateTime |
/// | event_time | UInt64 |
/// | query_id | String |
/// | remote_file_path | String |
/// | segment_range | Tuple |
/// | read_type | String |
/// -------------------------------------
///
struct FilesystemCacheLogElement struct FilesystemCacheLogElement
{ {
enum class CacheType enum class CacheType

View File

@ -370,15 +370,15 @@ BlockIO InterpreterSystemQuery::execute()
else else
{ {
auto cache = FileCacheFactory::instance().getByName(query.filesystem_cache_name).cache; auto cache = FileCacheFactory::instance().getByName(query.filesystem_cache_name).cache;
if (query.delete_key.empty()) if (query.key_to_drop.empty())
{ {
cache->removeAllReleasable(); cache->removeAllReleasable();
} }
else else
{ {
auto key = FileCacheKey::fromKeyString(query.delete_key); auto key = FileCacheKey::fromKeyString(query.key_to_drop);
if (query.delete_offset.has_value()) if (query.offset_to_drop.has_value())
cache->removeFileSegment(key, query.delete_offset.value()); cache->removeFileSegment(key, query.offset_to_drop.value());
else else
cache->removeKey(key); cache->removeKey(key);
} }

View File

@ -212,11 +212,11 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
if (!filesystem_cache_name.empty()) if (!filesystem_cache_name.empty())
{ {
settings.ostr << (settings.hilite ? hilite_none : "") << " " << filesystem_cache_name; settings.ostr << (settings.hilite ? hilite_none : "") << " " << filesystem_cache_name;
if (!delete_key.empty()) if (!key_to_drop.empty())
{ {
settings.ostr << (settings.hilite ? hilite_none : "") << " KEY " << delete_key; settings.ostr << (settings.hilite ? hilite_none : "") << " KEY " << key_to_drop;
if (delete_offset.has_value()) if (offset_to_drop.has_value())
settings.ostr << (settings.hilite ? hilite_none : "") << " OFFSET " << delete_offset.value(); settings.ostr << (settings.hilite ? hilite_none : "") << " OFFSET " << offset_to_drop.value();
} }
} }
} }

View File

@ -107,8 +107,8 @@ public:
UInt64 seconds{}; UInt64 seconds{};
String filesystem_cache_name; String filesystem_cache_name;
std::string delete_key; std::string key_to_drop;
std::optional<size_t> delete_offset; std::optional<size_t> offset_to_drop;
String backup_name; String backup_name;

View File

@ -409,9 +409,9 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
res->filesystem_cache_name = ast->as<ASTLiteral>()->value.safeGet<String>(); res->filesystem_cache_name = ast->as<ASTLiteral>()->value.safeGet<String>();
if (ParserKeyword{"KEY"}.ignore(pos, expected) && ParserIdentifier().parse(pos, ast, expected)) if (ParserKeyword{"KEY"}.ignore(pos, expected) && ParserIdentifier().parse(pos, ast, expected))
{ {
res->delete_key = ast->as<ASTIdentifier>()->name(); res->key_to_drop = ast->as<ASTIdentifier>()->name();
if (ParserKeyword{"OFFSET"}.ignore(pos, expected) && ParserLiteral().parse(pos, ast, expected)) if (ParserKeyword{"OFFSET"}.ignore(pos, expected) && ParserLiteral().parse(pos, ast, expected))
res->delete_offset = ast->as<ASTLiteral>()->value.safeGet<UInt64>(); res->offset_to_drop = ast->as<ASTLiteral>()->value.safeGet<UInt64>();
} }
} }
if (!parseQueryWithOnCluster(res, pos, expected)) if (!parseQueryWithOnCluster(res, pos, expected))