forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableFunctionTimeSeries.h
More file actions
42 lines (31 loc) · 1.38 KB
/
TableFunctionTimeSeries.h
File metadata and controls
42 lines (31 loc) · 1.38 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
#pragma once
#include <Parsers/ASTViewTargets.h>
#include <TableFunctions/ITableFunction.h>
#include <Storages/StorageTimeSeries.h>
namespace DB
{
/// Table functions timeSeriesData('mydb', 'my_ts_table'), timeSeriesTags('mydb', 'my_ts_table'), timeSeriesMetrics('mydb', 'my_ts_table')
/// return the data table, the tags table, and the metrics table respectively associated with any TimeSeries table mydb.my_ts_table
template <ViewTarget::Kind target_kind>
class TableFunctionTimeSeriesTarget : public ITableFunction
{
public:
static constexpr auto name = (target_kind == ViewTarget::Data)
? "timeSeriesData"
: ((target_kind == ViewTarget::Tags) ? "timeSeriesTags" : "timeSeriesMetrics");
String getName() const override { return name; }
private:
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
StoragePtr executeImpl(
const ASTPtr & ast_function,
ContextPtr context,
const std::string & table_name,
ColumnsDescription cached_columns,
bool is_insert_query) const override;
ColumnsDescription getActualTableStructure(ContextPtr context, bool is_insert_query) const override;
const char * getStorageTypeName() const override;
StoragePtr getTargetTable(const ContextPtr & context) const;
StorageID time_series_storage_id = StorageID::createEmpty();
String target_table_type_name;
};
}