ClickHouse/src/Functions/tuple.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
1.0 KiB
C++
Raw Normal View History

#include <Functions/tuple.h>
2018-09-10 00:58:04 +00:00
#include <Core/Settings.h>
2018-09-10 00:58:04 +00:00
namespace DB
{
FunctionPtr FunctionTuple::create(DB::ContextPtr context)
{
return std::make_shared<FunctionTuple>(context->getSettingsRef().enable_named_columns_in_function_tuple);
}
REGISTER_FUNCTION(Tuple)
2018-09-10 00:58:04 +00:00
{
2024-06-18 12:35:33 +00:00
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"}});
2018-09-10 00:58:04 +00:00
}
}