ClickHouse/src/TableFunctions/TableFunctionNumbers.h

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

32 lines
974 B
C++
Raw Normal View History

#pragma once
#include <TableFunctions/ITableFunction.h>
2021-10-02 07:13:14 +00:00
#include <base/types.h>
namespace DB
{
2019-08-19 12:27:51 +00:00
/* numbers(limit), numbers_mt(limit)
* - the same as SELECT number FROM system.numbers LIMIT limit.
* Used for testing purposes, as a simple example of table function.
*/
2019-08-19 12:27:51 +00:00
template <bool multithreaded>
class TableFunctionNumbers : public ITableFunction
{
public:
2019-08-19 12:27:51 +00:00
static constexpr auto name = multithreaded ? "numbers_mt" : "numbers";
std::string getName() const override { return name; }
bool hasStaticStructure() const override { return true; }
private:
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override;
const char * getStorageTypeName() const override { return "SystemNumbers"; }
UInt64 evaluateArgument(ContextPtr context, ASTPtr & argument) const;
ColumnsDescription getActualTableStructure(ContextPtr context) const override;
};
}