Created
March 10, 2019 13:48
-
-
Save den-crane/005633470c70877dd28c00211cd9fcfb to your computer and use it in GitHub Desktop.
MV union all workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table tableA (A String) Engine=MergeTree order by tuple(); | |
create table tableB (B String) Engine=MergeTree order by tuple(); | |
create table tableC (C String) Engine=Null; | |
create table storeABC(ABC String) Engine=MergeTree order by tuple(); | |
create materialized view MVA to storeABC as select A ABC from tableA; | |
create materialized view MVB to storeABC as select B ABC from tableB; | |
create materialized view MVC to storeABC as select C ABC from tableC; | |
insert into tableA values('A'); | |
insert into tableB values('B'); | |
insert into tableC values('C'); | |
select * from storeABC; | |
┌─ABC─┐ | |
│ A │ | |
│ B │ | |
│ C │ | |
└─────┘ | |
select * from MVC; (the same store storeABC -> the same result) | |
┌─ABC─┐ | |
│ A │ | |
│ B │ | |
│ C │ | |
└─────┘ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment