ClickHouse/src/Functions/tuple.cpp
2024-07-11 17:33:14 +02:00

29 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <Functions/tuple.h>
#include <Core/Settings.h>
namespace DB
{
FunctionPtr FunctionTuple::create(DB::ContextPtr context)
{
return std::make_shared<FunctionTuple>(context->getSettingsRef().enable_named_columns_in_function_tuple);
}
REGISTER_FUNCTION(Tuple)
{
factory.registerFunction<FunctionTuple>(FunctionDocumentation{
.description = R"(
Returns a tuple by grouping input arguments.
For columns C1, C2, ... with the types T1, T2, ..., it returns a named Tuple(C1 T1, C2 T2, ...) type tuple containing these columns if their names are unique and can be treated as unquoted identifiers, otherwise a Tuple(T1, T2, ...) is returned. There is no cost to execute the function.
Tuples are normally used as intermediate values for an argument of IN operators, or for creating a list of formal parameters of lambda functions. Tuples cant be written to a table.
The function implements the operator `(x, y, ...)`.
)",
.examples{{"typical", "SELECT tuple(1, 2)", "(1,2)"}},
.categories{"Miscellaneous"}});
}
}