mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #8351 from ClickHouse/fix-dict-with-clickhouse-source-and-subquery
Fix dict with clickhouse source and subquery
This commit is contained in:
commit
6541b2db9e
@ -76,6 +76,9 @@ ClickHouseDictionarySource::ClickHouseDictionarySource(
|
||||
context.setUser(user, password, Poco::Net::SocketAddress("127.0.0.1", 0), {});
|
||||
/// Processors are not supported here yet.
|
||||
context.getSettingsRef().experimental_use_processors = false;
|
||||
/// Query context is needed because some code in executeQuery function may assume it exists.
|
||||
/// Current example is Context::getSampleBlockCache from InterpreterSelectWithUnionQuery::getSampleBlock.
|
||||
context.makeQueryContext();
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +103,7 @@ ClickHouseDictionarySource::ClickHouseDictionarySource(const ClickHouseDictionar
|
||||
, pool{is_local ? nullptr : createPool(host, port, secure, db, user, password)}
|
||||
, load_all_query{other.load_all_query}
|
||||
{
|
||||
context.makeQueryContext();
|
||||
}
|
||||
|
||||
std::string ClickHouseDictionarySource::getUpdateFieldAndDate()
|
||||
|
@ -0,0 +1 @@
|
||||
a_y_x
|
@ -0,0 +1,16 @@
|
||||
drop table if exists default.test_01051_d;
|
||||
drop table if exists default.test_view_01051_d;
|
||||
drop dictionary if exists default.test_dict_01051_d;
|
||||
|
||||
create table default.test_01051_d (key UInt64, value String) engine = MergeTree order by key;
|
||||
create view default.test_view_01051_d (key UInt64, value String) as select k2 + 1 as key, v2 || '_x' as value from (select key + 2 as k2, value || '_y' as v2 from default.test_01051_d);
|
||||
|
||||
insert into default.test_01051_d values (1, 'a');
|
||||
|
||||
create dictionary default.test_dict_01051_d (key UInt64, value String) primary key key source(clickhouse(host 'localhost' port '9000' user 'default' password '' db 'default' table 'test_view_01051_d')) layout(flat()) lifetime(100500);
|
||||
|
||||
select dictGet('default.test_dict_01051_d', 'value', toUInt64(4));
|
||||
|
||||
drop table if exists default.test_01051_d;
|
||||
drop table if exists default.test_view_01051_d;
|
||||
drop dictionary if exists default.test_dict_01051_d;
|
Loading…
Reference in New Issue
Block a user