This commit is contained in:
Alexander Kuzmenkov 2020-09-09 14:05:49 +03:00
parent c62bf555d2
commit f0c5459807
5 changed files with 24 additions and 9 deletions

View File

@ -389,6 +389,8 @@ 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)
{
try
{
const auto & accessor = Traits::Accessor::instance();
if (size_t index = accessor.find(name); index != static_cast<size_t>(-1))
@ -398,6 +400,12 @@ Field BaseSettings<Traits_>::stringToValueUtil(const std::string_view & name, co
else
BaseSettingsHelpers::throwSettingNotFound(name);
}
catch (Exception & e)
{
e.addMessage("while parsing value '{}' for setting '{}'", str, name);
throw;
}
}
template <typename Traits_>
void BaseSettings<Traits_>::write(WriteBuffer & out, SettingsWriteFormat format) const

View File

@ -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

View File

@ -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;

View File

@ -7,4 +7,4 @@
2
1
===sampled===
1 1
OK

View File

@ -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'