mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
fix typo
This commit is contained in:
parent
f7e65ebd72
commit
bd2bd7149d
@ -61,7 +61,7 @@ String Range::toString() const
|
||||
/// - (1) the pattern has a wildcard
|
||||
/// - (2) the first wildcard is '%' and is only followed by nothing or other '%'
|
||||
/// e.g. 'test%' or 'test%% has perfect prefix 'test', 'test%x', 'test%_' or 'test_' has no perfect prefix.
|
||||
String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool require_perfect_prefix)
|
||||
String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool requires_perfect_prefix)
|
||||
{
|
||||
String fixed_prefix;
|
||||
fixed_prefix.reserve(like_pattern.size());
|
||||
@ -74,7 +74,7 @@ String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool req
|
||||
{
|
||||
case '%':
|
||||
case '_':
|
||||
if (require_perfect_prefix)
|
||||
if (requires_perfect_prefix)
|
||||
{
|
||||
bool is_prefect_prefix = std::all_of(pos, end, [](auto c) { return c == '%'; });
|
||||
return is_prefect_prefix ? fixed_prefix : "";
|
||||
@ -92,7 +92,7 @@ String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool req
|
||||
++pos;
|
||||
}
|
||||
/// If we can reach this code, it means there was no wildcard found in the pattern, so it is not a perfect prefix
|
||||
if (require_perfect_prefix)
|
||||
if (requires_perfect_prefix)
|
||||
return "";
|
||||
return fixed_prefix;
|
||||
}
|
||||
@ -356,7 +356,7 @@ const KeyCondition::AtomMap KeyCondition::atom_map
|
||||
if (value.getType() != Field::Types::String)
|
||||
return false;
|
||||
|
||||
String prefix = extractFixedPrefixFromLikePattern(value.get<const String &>(), /*required_perfect_prefix*/ false);
|
||||
String prefix = extractFixedPrefixFromLikePattern(value.get<const String &>(), /*requires_perfect_prefix*/ false);
|
||||
if (prefix.empty())
|
||||
return false;
|
||||
|
||||
@ -377,7 +377,7 @@ const KeyCondition::AtomMap KeyCondition::atom_map
|
||||
if (value.getType() != Field::Types::String)
|
||||
return false;
|
||||
|
||||
String prefix = extractFixedPrefixFromLikePattern(value.get<const String &>(), /*required_perfect_prefix*/ true);
|
||||
String prefix = extractFixedPrefixFromLikePattern(value.get<const String &>(), /*requires_perfect_prefix*/ true);
|
||||
if (prefix.empty())
|
||||
return false;
|
||||
|
||||
|
@ -485,6 +485,6 @@ private:
|
||||
bool strict;
|
||||
};
|
||||
|
||||
String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool require_perfect_prefix);
|
||||
String extractFixedPrefixFromLikePattern(std::string_view like_pattern, bool requires_perfect_prefix);
|
||||
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void StorageSystemMergeTreeMetadataCache::fillData(MutableColumns & res_columns,
|
||||
}
|
||||
else
|
||||
{
|
||||
String target = extractFixedPrefixFromLikePattern(key, /*required_perfect_prefix*/ false);
|
||||
String target = extractFixedPrefixFromLikePattern(key, /*requires_perfect_prefix*/ false);
|
||||
if (target.empty())
|
||||
throw Exception(
|
||||
"SELECT from system.merge_tree_metadata_cache table must contain condition like key = 'key' or key LIKE 'prefix%' in WHERE clause.", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
Loading…
Reference in New Issue
Block a user