2023-08-23 15:46:56 +00:00
|
|
|
|
#include <Functions/tuple.h>
|
2018-09-10 00:58:04 +00:00
|
|
|
|
|
2024-07-11 15:33:14 +00:00
|
|
|
|
#include <Core/Settings.h>
|
|
|
|
|
|
2018-09-10 00:58:04 +00:00
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
2024-07-11 15:33:14 +00:00
|
|
|
|
FunctionPtr FunctionTuple::create(DB::ContextPtr context)
|
|
|
|
|
{
|
|
|
|
|
return std::make_shared<FunctionTuple>(context->getSettingsRef().enable_named_columns_in_function_tuple);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
|
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 can’t 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|