Trying to fix issue with calculating default expressions. (Not working yet)

This commit is contained in:
Vitaliy Zakaznikov 2020-01-22 14:34:00 +01:00
parent 507609b611
commit 78ab3127ce
4 changed files with 29 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include <DataStreams/AddingDefaultBlockOutputStream.h>
#include <DataStreams/AddingMissedBlockInputStream.h>
#include <DataStreams/ConvertingBlockInputStream.h>
#include <DataStreams/PushingToViewsBlockOutputStream.h>
#include <DataStreams/SquashingBlockInputStream.h>
@ -230,7 +231,9 @@ void PushingToViewsBlockOutputStream::process(const Block & block, size_t view_n
/// and two-level aggregation is triggered).
in = std::make_shared<SquashingBlockInputStream>(
in, context.getSettingsRef().min_insert_block_size_rows, context.getSettingsRef().min_insert_block_size_bytes);
in = std::make_shared<ConvertingBlockInputStream>(context, in, view.out->getHeader(), ConvertingBlockInputStream::MatchColumnsMode::NameOrDefault);
in = std::make_shared<AddingMissedBlockInputStream>(
in, view.out->getHeader(), storage->getColumns().getDefaults(), local_context);
in = std::make_shared<ConvertingBlockInputStream>(context, in, view.out->getHeader(), ConvertingBlockInputStream::MatchColumnsMode::Name);
}
else
in = std::make_shared<OneBlockInputStream>(block);

View File

@ -1,3 +1,4 @@
DROP TABLE IF EXISTS mv;
DROP TABLE IF EXISTS mv_source;
DROP TABLE IF EXISTS mv_target;

View File

@ -0,0 +1,16 @@
DROP TABLE IF EXISTS mv;
DROP TABLE IF EXISTS mv_source;
DROP TABLE IF EXISTS mv_target;
CREATE TABLE mv_source (`a` UInt64) ENGINE = MergeTree ORDER BY tuple();
CREATE TABLE mv_target (`a` UInt64) ENGINE = MergeTree ORDER BY tuple();
CREATE MATERIALIZED VIEW mv TO mv_target AS SELECT * FROM mv_source;
INSERT INTO mv_source VALUES (1);
ALTER TABLE mv_target ADD COLUMN b UInt8 DEFAULT a + 1;
INSERT INTO mv_source VALUES (1),(2),(3);
SELECT * FROM mv ORDER BY a;
SELECT * FROM mv_target ORDER BY a;