1#include <DataStreams/AddingMissedBlockInputStream.h>
2#include <Interpreters/addMissingDefaults.h>
3
4
5namespace DB
6{
7
8AddingMissedBlockInputStream::AddingMissedBlockInputStream(
9 const BlockInputStreamPtr & input_,
10 const Block & header_,
11 const ColumnDefaults & column_defaults_,
12 const Context & context_)
13 : input(input_), header(header_),
14 column_defaults(column_defaults_), context(context_)
15{
16 children.emplace_back(input);
17}
18
19Block AddingMissedBlockInputStream::readImpl()
20{
21 Block src = children.back()->read();
22 if (!src)
23 return src;
24
25 return addMissingDefaults(src, header.getNamesAndTypesList(), column_defaults, context);
26}
27
28}
29