2018-07-04 17:02:47 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-23 14:48:50 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2018-07-04 17:02:47 +00:00
|
|
|
#include <Storages/ColumnDefault.h>
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Adds defaults to columns using BlockDelayedDefaults bitmask attached to Block by child InputStream.
|
2019-01-23 14:48:50 +00:00
|
|
|
class AddingDefaultsBlockInputStream : public IBlockInputStream
|
2018-07-04 17:02:47 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
AddingDefaultsBlockInputStream(
|
|
|
|
const BlockInputStreamPtr & input,
|
|
|
|
const ColumnDefaults & column_defaults_,
|
|
|
|
const Context & context_);
|
|
|
|
|
|
|
|
String getName() const override { return "AddingDefaults"; }
|
|
|
|
Block getHeader() const override { return header; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Block readImpl() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Block header;
|
|
|
|
const ColumnDefaults column_defaults;
|
|
|
|
const Context & context;
|
2018-11-15 20:26:51 +00:00
|
|
|
|
|
|
|
void checkCalculated(const ColumnWithTypeAndName & col_read, const ColumnWithTypeAndName & col_defaults, size_t needed) const;
|
|
|
|
MutableColumnPtr mixColumns(const ColumnWithTypeAndName & col_read, const ColumnWithTypeAndName & col_defaults,
|
|
|
|
const BlockMissingValues::RowsBitMask & defaults_mask) const;
|
|
|
|
void mixNumberColumns(TypeIndex type_idx, MutableColumnPtr & col_mixed, const ColumnPtr & col_defaults,
|
|
|
|
const BlockMissingValues::RowsBitMask & defaults_mask) const;
|
2018-07-04 17:02:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|