1#pragma once
2
3#include <DataStreams/IBlockInputStream.h>
4#include <Storages/ColumnDefault.h>
5
6
7namespace DB
8{
9
10
11/** This stream adds three types of columns into block
12 * 1. Columns, that are missed inside request, but present in table without defaults (missed columns)
13 * 2. Columns, that are missed inside request, but present in table with defaults (columns with default values)
14 * 3. Columns that materialized from other columns (materialized columns)
15 * All three types of columns are materialized (not constants).
16 */
17class AddingMissedBlockInputStream : public IBlockInputStream
18{
19public:
20 AddingMissedBlockInputStream(
21 const BlockInputStreamPtr & input_,
22 const Block & header_,
23 const ColumnDefaults & column_defaults_,
24 const Context & context_);
25
26 String getName() const override { return "AddingMissed"; }
27 Block getHeader() const override { return header; }
28
29private:
30 Block readImpl() override;
31
32 BlockInputStreamPtr input;
33 /// Blocks after this stream should have this structure
34 const Block header;
35 const ColumnDefaults column_defaults;
36 const Context & context;
37};
38
39
40}
41