-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathTableFunctionProxyBase.h
62 lines (47 loc) · 1.92 KB
/
TableFunctionProxyBase.h
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
55
56
57
58
59
60
61
62
#pragma once
#include <TableFunctions/ITableFunction.h>
#include <Interpreters/ExpressionActions.h>
#include <Interpreters/StorageID.h>
#include <Interpreters/Streaming/TableFunctionDescription_fwd.h>
#include <Interpreters/Streaming/TimestampFunctionDescription_fwd.h>
#include <Interpreters/TreeRewriter.h>
#include <Storages/StorageInMemoryMetadata.h>
#include <Storages/StorageSnapshot.h>
#include <Core/Streaming/DataStreamSemantic.h>
namespace DB
{
using TreeRewriterResultPtr = std::shared_ptr<const TreeRewriterResult>;
namespace Streaming
{
class TableFunctionProxyBase : public ITableFunction
{
public:
explicit TableFunctionProxyBase(const String & name_);
String getName() const override { return name; }
ColumnsDescription getActualTableStructure(ContextPtr context) const override;
virtual StoragePtr calculateColumnDescriptions(ContextPtr context);
protected:
void resolveStorageID(const ASTPtr & arg, ContextPtr context);
StoragePtr
executeImpl(const ASTPtr & func_ast, ContextPtr context, const String & table_name, ColumnsDescription cached_columns) const override;
TableFunctionDescriptionMutablePtr createStreamingTableFunctionDescription(ASTPtr ast, ContextPtr context) const;
virtual NamesAndTypesList getAdditionalResultColumns(const ColumnsWithTypeAndName &) const { return {}; }
private:
void validateProxyChain() const;
protected:
String name;
TableFunctionDescriptionMutablePtr streaming_func_desc;
/// Timestamp column expression
TimestampFunctionDescriptionMutablePtr timestamp_func_desc;
StoragePtr storage;
ASTPtr subquery;
StorageID storage_id = StorageID::createEmpty();
StorageSnapshotPtr underlying_storage_snapshot;
ColumnsDescription columns;
/// Nested ProxyStorage for nested table function: tumble(dedup(...))
StoragePtr nested_proxy_storage;
bool streaming = true;
DataStreamSemanticEx data_stream_semantic;
};
}
}