mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge pull request #68595 from ClickHouse/vdimir/fix_function_printf_style
Fix style in Functions/printf.cpp
This commit is contained in:
commit
1986fb1418
@ -50,13 +50,6 @@ private:
|
|||||||
return executeNonconstant(input);
|
return executeNonconstant(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] String toString() const
|
|
||||||
{
|
|
||||||
WriteBufferFromOwnString buf;
|
|
||||||
buf << "format:" << format << ", rows:" << rows << ", is_literal:" << is_literal << ", input:" << input.dumpStructure() << "\n";
|
|
||||||
return buf.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ColumnWithTypeAndName executeLiteral(std::string_view literal) const
|
ColumnWithTypeAndName executeLiteral(std::string_view literal) const
|
||||||
{
|
{
|
||||||
@ -231,9 +224,7 @@ public:
|
|||||||
const auto & instruction = instructions[i];
|
const auto & instruction = instructions[i];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// std::cout << "instruction[" << i << "]:" << instructions[i].toString() << std::endl;
|
|
||||||
concat_args[i] = instruction.execute();
|
concat_args[i] = instruction.execute();
|
||||||
// std::cout << "concat_args[" << i << "]:" << concat_args[i].dumpStructure() << std::endl;
|
|
||||||
}
|
}
|
||||||
catch (const fmt::v9::format_error & e)
|
catch (const fmt::v9::format_error & e)
|
||||||
{
|
{
|
||||||
@ -358,7 +349,14 @@ private:
|
|||||||
|
|
||||||
REGISTER_FUNCTION(Printf)
|
REGISTER_FUNCTION(Printf)
|
||||||
{
|
{
|
||||||
factory.registerFunction<FunctionPrintf>();
|
factory.registerFunction<FunctionPrintf>(
|
||||||
|
FunctionDocumentation{.description=R"(
|
||||||
|
The `printf` function formats the given string with the values (strings, integers, floating-points etc.) listed in the arguments, similar to printf function in C++.
|
||||||
|
The format string can contain format specifiers starting with `%` character.
|
||||||
|
Anything not contained in `%` and the following format specifier is considered literal text and copied verbatim into the output.
|
||||||
|
Literal `%` character can be escaped by `%%`.)", .examples{{"sum", "select printf('%%%s %s %d', 'Hello', 'World', 2024);", "%Hello World 2024"}}, .categories{"String"}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,6 @@ positionCaseInsensitive
|
|||||||
positionCaseInsensitiveUTF8
|
positionCaseInsensitiveUTF8
|
||||||
positionUTF8
|
positionUTF8
|
||||||
pow
|
pow
|
||||||
printf
|
|
||||||
proportionsZTest
|
proportionsZTest
|
||||||
protocol
|
protocol
|
||||||
queryID
|
queryID
|
||||||
|
Loading…
Reference in New Issue
Block a user