ClickHouse/src/TableFunctions/TableFunctionZeros.h

32 lines
975 B
C++
Raw Normal View History

#pragma once
#include <TableFunctions/ITableFunction.h>
2020-09-15 09:55:57 +00:00
#include <common/types.h>
namespace DB
{
/* zeros(limit), zeros_mt(limit)
2020-03-10 18:17:16 +00:00
* - the same as SELECT zero FROM system.zeros LIMIT limit.
* Used for testing purposes, as a simple example of table function.
*/
template <bool multithreaded>
class TableFunctionZeros : public ITableFunction
{
public:
static constexpr auto name = multithreaded ? "zeros_mt" : "zeros";
std::string getName() const override { return name; }
bool hasStaticStructure() const override { return true; }
private:
StoragePtr executeImpl(const ASTPtr & ast_function, const Context & context, const std::string & table_name, ColumnsDescription cached_columns) const override;
const char * getStorageTypeName() const override { return "SystemZeros"; }
UInt64 evaluateArgument(const Context & context, ASTPtr & argument) const;
ColumnsDescription getActualTableStructure(const Context & context) const override;
};
}