forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathidentity.cpp
More file actions
54 lines (48 loc) · 1.96 KB
/
identity.cpp
File metadata and controls
54 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <Functions/identity.h>
#include <Functions/FunctionFactory.h>
#include <Common/FunctionDocumentation.h>
namespace DB
{
REGISTER_FUNCTION(Identity)
{
FunctionDocumentation::Description description = R"(
This function returns the argument you pass to it, which is useful for debugging and testing. It lets you bypass index usage to see full scan performance instead. The query analyzer ignores anything inside identity functions when looking for indexes to use, and it also disables constant folding.
)";
FunctionDocumentation::Syntax syntax = "identity(x)";
FunctionDocumentation::Arguments arguments = {
{"x", "Input value.", {"Any"}}
};
FunctionDocumentation::ReturnedValue returned_value = {"Returns the input value unchanged.", {"Any"}};
FunctionDocumentation::Examples examples = {
{"Usage example", "SELECT identity(42)", "42"}
};
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::Other;
FunctionDocumentation documentation = {description, syntax, arguments, {}, returned_value, examples, introduced_in, category};
factory.registerFunction<FunctionIdentity>(documentation);
}
REGISTER_FUNCTION(ScalarSubqueryResult)
{
factory.registerFunction<FunctionScalarSubqueryResult>();
}
REGISTER_FUNCTION(ActionName)
{
factory.registerFunction<FunctionActionName>();
}
REGISTER_FUNCTION(AliasMarker)
{
factory.registerFunction<FunctionAliasMarker>(FunctionDocumentation{
.description = R"(
Internal function. Not for direct use.
)",
.syntax = {"__aliasMarker(expr, alias_name)"},
.arguments = {
{"expr", "Expression to mark.", {"Any"}},
{"alias_name", "Alias name attached to the expression.", {"String"}},
},
.returned_value = {"Returns expr unchanged.", {"Any"}},
.introduced_in = {25, 8},
.category = FunctionDocumentation::Category::Other,
});
}
}