mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
tests
This commit is contained in:
parent
c62bf555d2
commit
f0c5459807
@ -390,13 +390,21 @@ String BaseSettings<Traits_>::valueToStringUtil(const std::string_view & name, c
|
||||
template <typename Traits_>
|
||||
Field BaseSettings<Traits_>::stringToValueUtil(const std::string_view & name, const String & str)
|
||||
{
|
||||
const auto & accessor = Traits::Accessor::instance();
|
||||
if (size_t index = accessor.find(name); index != static_cast<size_t>(-1))
|
||||
return accessor.stringToValueUtil(index, str);
|
||||
if constexpr (Traits::allow_custom_settings)
|
||||
return Field::restoreFromDump(str);
|
||||
else
|
||||
BaseSettingsHelpers::throwSettingNotFound(name);
|
||||
try
|
||||
{
|
||||
const auto & accessor = Traits::Accessor::instance();
|
||||
if (size_t index = accessor.find(name); index != static_cast<size_t>(-1))
|
||||
return accessor.stringToValueUtil(index, str);
|
||||
if constexpr (Traits::allow_custom_settings)
|
||||
return Field::restoreFromDump(str);
|
||||
else
|
||||
BaseSettingsHelpers::throwSettingNotFound(name);
|
||||
}
|
||||
catch (Exception & e)
|
||||
{
|
||||
e.addMessage("while parsing value '{}' for setting '{}'", str, name);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Traits_>
|
||||
|
@ -5,3 +5,4 @@
|
||||
01234567-89ab-cdef-0123-456789abcdef 01234567-89ab-cdef-0123-456789abcdef 01234567-89ab-cdef-0123-456789abcdef
|
||||
01234567-89ab-cdef-0123-456789abcdef 01234567-89ab-cdef-0123-456789abcdef 01234567-89ab-cdef-0123-456789abcdef
|
||||
3f1ed72e-f7fe-4459-9cbe-95fe9298f845
|
||||
1
|
||||
|
@ -5,3 +5,9 @@ SELECT hex(UUIDStringToNum(materialize('01234567-89ab-cdef-0123-456789abcdef')))
|
||||
SELECT '01234567-89ab-cdef-0123-456789abcdef' AS str, UUIDNumToString(UUIDStringToNum(str)), UUIDNumToString(UUIDStringToNum(toFixedString(str, 36)));
|
||||
SELECT materialize('01234567-89ab-cdef-0123-456789abcdef') AS str, UUIDNumToString(UUIDStringToNum(str)), UUIDNumToString(UUIDStringToNum(toFixedString(str, 36)));
|
||||
SELECT toString(toUUID('3f1ed72e-f7fe-4459-9cbe-95fe9298f845'));
|
||||
|
||||
-- conversion back and forth to big-endian hex string
|
||||
with generateUUIDv4() as uuid,
|
||||
identity(lower(hex(reverse(reinterpretAsString(uuid))))) as str,
|
||||
reinterpretAsUUID(reverse(unhex(str))) uuid2
|
||||
select uuid = uuid2;
|
||||
|
@ -7,4 +7,4 @@
|
||||
2
|
||||
1
|
||||
===sampled===
|
||||
1 1
|
||||
OK
|
||||
|
@ -74,7 +74,7 @@ done
|
||||
${CLICKHOUSE_CLIENT} -q "
|
||||
with count(*) as c
|
||||
-- expect 200 * 0.1 = 20 sampled events on average
|
||||
select c > 10, c < 30
|
||||
select if(c > 10 and c < 30, 'OK', 'fail: ' || toString(c))
|
||||
from system.opentelemetry_log
|
||||
array join attribute.names as name, attribute.values as value
|
||||
where name = 'clickhouse.query_id'
|
||||
|
Loading…
Reference in New Issue
Block a user