mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #36390 from lthaooo/fix_dictionary_reload_bug
fix dictionary reload bug
This commit is contained in:
commit
fa1579cdd5
@ -169,9 +169,13 @@ Pipe ClickHouseDictionarySource::createStreamForQuery(const String & query, std:
|
||||
/// Sample block should not contain first row default values
|
||||
auto empty_sample_block = sample_block.cloneEmpty();
|
||||
|
||||
auto context_copy = Context::createCopy(context);
|
||||
context_copy->makeQueryContext();
|
||||
|
||||
if (configuration.is_local)
|
||||
{
|
||||
builder.init(executeQuery(query, context, true).pipeline);
|
||||
|
||||
builder.init(executeQuery(query, context_copy, true).pipeline);
|
||||
auto converting = ActionsDAG::makeConvertingActions(
|
||||
builder.getHeader().getColumnsWithTypeAndName(),
|
||||
empty_sample_block.getColumnsWithTypeAndName(),
|
||||
@ -185,7 +189,7 @@ Pipe ClickHouseDictionarySource::createStreamForQuery(const String & query, std:
|
||||
else
|
||||
{
|
||||
builder.init(Pipe(std::make_shared<RemoteSource>(
|
||||
std::make_shared<RemoteQueryExecutor>(pool, query, empty_sample_block, context), false, false)));
|
||||
std::make_shared<RemoteQueryExecutor>(pool, query, empty_sample_block, context_copy), false, false)));
|
||||
}
|
||||
|
||||
if (result_size_hint)
|
||||
|
@ -1,3 +1,7 @@
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
3 3
|
||||
0
|
||||
0
|
||||
4 4
|
||||
|
@ -52,4 +52,42 @@ SELECT * FROM 01780_db.dict3;
|
||||
|
||||
DROP DICTIONARY 01780_db.dict3;
|
||||
|
||||
DROP TABLE IF EXISTS 01780_db.dict4_source;
|
||||
CREATE TABLE 01780_db.dict4_source
|
||||
(
|
||||
id UInt64,
|
||||
value String
|
||||
) ENGINE = TinyLog;
|
||||
|
||||
DROP TABLE IF EXISTS 01780_db.dict4_view;
|
||||
CREATE VIEW 01780_db.dict4_view
|
||||
(
|
||||
id UInt64,
|
||||
value String
|
||||
) AS SELECT id, value FROM 01780_db.dict4_source WHERE id = (SELECT max(id) FROM 01780_db.dict4_source);
|
||||
|
||||
INSERT INTO 01780_db.dict4_source VALUES (1, '1'), (2, '2'), (3, '3');
|
||||
|
||||
DROP DICTIONARY IF EXISTS 01780_db.dict4;
|
||||
CREATE DICTIONARY 01780_db.dict4
|
||||
(
|
||||
id UInt64,
|
||||
value String
|
||||
)
|
||||
PRIMARY KEY id
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 TABLE 'dict4_view' DATABASE '01780_db'))
|
||||
LIFETIME(MIN 0 MAX 1)
|
||||
LAYOUT(COMPLEX_KEY_HASHED());
|
||||
|
||||
SELECT * FROM 01780_db.dict4;
|
||||
|
||||
INSERT INTO 01780_db.dict4_source VALUES (4, '4');
|
||||
|
||||
SELECT sleep(3);
|
||||
SELECT sleep(3);
|
||||
|
||||
SELECT * FROM 01780_db.dict4;
|
||||
|
||||
DROP DICTIONARY 01780_db.dict4;
|
||||
|
||||
DROP DATABASE 01780_db;
|
||||
|
Loading…
Reference in New Issue
Block a user