Skip to content

Commit ef9b9a2

Browse files
committed
Refactor executeQuery.cpp to use convertFieldToString
1 parent 36e29e4 commit ef9b9a2

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/Interpreters/executeQuery.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <Common/MemoryTrackerBlockerInThread.h>
66
#include <Common/SensitiveDataMasker.h>
77
#include <Common/FailPoint.h>
8+
#include <Common/FieldVisitorToString.h>
89

910
#include <Interpreters/AsynchronousInsertQueue.h>
1011
#include <Interpreters/Cache/QueryCache.h>
@@ -577,29 +578,7 @@ void logQueryFinish(
577578
for (const auto & name : changed_settings_names)
578579
{
579580
Field value = settings.get(name);
580-
String value_str;
581-
582-
switch (value.getType())
583-
{
584-
case Field::Types::Which::String:
585-
value_str = value.safeGet<String>();
586-
break;
587-
case Field::Types::Which::Int64:
588-
value_str = std::to_string(value.safeGet<Int64>());
589-
break;
590-
case Field::Types::Which::Float64:
591-
value_str = std::to_string(value.safeGet<Float64>());
592-
break;
593-
case Field::Types::Which::Bool:
594-
value_str = value.safeGet<bool>() ? "true" : "false";
595-
break;
596-
case Field::Types::Which::UInt64:
597-
value_str = std::to_string(value.safeGet<UInt64>());
598-
break;
599-
default:
600-
value_str = "Unsupported type: " + std::to_string(static_cast<int>(value.getType()));
601-
break;
602-
}
581+
String value_str = convertFieldToString(value);
603582

604583
query_span->addAttribute(fmt::format("clickhouse.setting.{}", name), value_str);
605584

0 commit comments

Comments
 (0)