2018-11-27 00:43:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-23 14:48:50 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2018-11-27 00:43:58 +00:00
|
|
|
#include <Storages/ColumnDefault.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/** This stream adds three types of columns into block
|
|
|
|
* 1. Columns, that are missed inside request, but present in table without defaults (missed columns)
|
|
|
|
* 2. Columns, that are missed inside request, but present in table with defaults (columns with default values)
|
|
|
|
* 3. Columns that materialized from other columns (materialized columns)
|
|
|
|
* All three types of columns are materialized (not constants).
|
|
|
|
*/
|
2019-01-23 14:48:50 +00:00
|
|
|
class AddingMissedBlockInputStream : public IBlockInputStream
|
2018-11-27 00:43:58 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-12-05 12:27:21 +00:00
|
|
|
AddingMissedBlockInputStream(
|
2018-11-27 00:43:58 +00:00
|
|
|
const BlockInputStreamPtr & input_,
|
|
|
|
const Block & header_,
|
|
|
|
const ColumnDefaults & column_defaults_,
|
|
|
|
const Context & context_);
|
|
|
|
|
2018-12-06 17:20:17 +00:00
|
|
|
String getName() const override { return "AddingMissed"; }
|
2018-11-27 00:43:58 +00:00
|
|
|
Block getHeader() const override { return header; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Block readImpl() override;
|
|
|
|
|
|
|
|
BlockInputStreamPtr input;
|
|
|
|
/// Blocks after this stream should have this structure
|
|
|
|
const Block header;
|
|
|
|
const ColumnDefaults column_defaults;
|
|
|
|
const Context & context;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|