1 | #pragma once |
---|---|
2 | |
3 | #include <TableFunctions/ITableFunction.h> |
4 | #include <Core/Types.h> |
5 | |
6 | |
7 | namespace DB |
8 | { |
9 | |
10 | /* numbers(limit), numbers_mt(limit) |
11 | * - the same as SELECT number FROM system.numbers LIMIT limit. |
12 | * Used for testing purposes, as a simple example of table function. |
13 | */ |
14 | template <bool multithreaded> |
15 | class TableFunctionNumbers : public ITableFunction |
16 | { |
17 | public: |
18 | static constexpr auto name = multithreaded ? "numbers_mt": "numbers"; |
19 | std::string getName() const override { return name; } |
20 | private: |
21 | StoragePtr executeImpl(const ASTPtr & ast_function, const Context & context, const std::string & table_name) const override; |
22 | |
23 | UInt64 evaluateArgument(const Context & context, ASTPtr & argument) const; |
24 | }; |
25 | |
26 | |
27 | } |
28 |