mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #10105 from azat/distributed-insert-types-differs
Fix SIGSEGV on INSERT into Distributed on different struct with underlying
This commit is contained in:
commit
dad892e9d4
@ -305,7 +305,9 @@ ThreadPool::Job DistributedBlockOutputStream::runWritingJob(DistributedBlockOutp
|
|||||||
job.local_context = std::make_unique<Context>(context);
|
job.local_context = std::make_unique<Context>(context);
|
||||||
|
|
||||||
InterpreterInsertQuery interp(query_ast, *job.local_context);
|
InterpreterInsertQuery interp(query_ast, *job.local_context);
|
||||||
job.stream = interp.execute().out;
|
auto block_io = interp.execute();
|
||||||
|
assertBlocksHaveEqualStructure(block_io.out->getHeader(), shard_block, "flushing shard block for " + storage.getStorageID().getNameForLogs());
|
||||||
|
job.stream = block_io.out;
|
||||||
job.stream->writePrefix();
|
job.stream->writePrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,6 +546,9 @@ void DistributedBlockOutputStream::writeToLocal(const Block & block, const size_
|
|||||||
InterpreterInsertQuery interp(query_ast, context);
|
InterpreterInsertQuery interp(query_ast, context);
|
||||||
|
|
||||||
auto block_io = interp.execute();
|
auto block_io = interp.execute();
|
||||||
|
|
||||||
|
assertBlocksHaveEqualStructure(block_io.out->getHeader(), block, "flushing " + storage.getStorageID().getNameForLogs());
|
||||||
|
|
||||||
block_io.out->writePrefix();
|
block_io.out->writePrefix();
|
||||||
|
|
||||||
for (size_t i = 0; i < repeats; ++i)
|
for (size_t i = 0; i < repeats; ++i)
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
DROP TABLE IF EXISTS dist_00967;
|
||||||
|
DROP TABLE IF EXISTS underlying_00967;
|
||||||
|
|
||||||
|
CREATE TABLE dist_00967 (key UInt64) Engine=Distributed('test_shard_localhost', currentDatabase(), underlying_00967);
|
||||||
|
-- fails for TinyLog()/MergeTree()/... but not for Memory()
|
||||||
|
CREATE TABLE underlying_00967 (key Nullable(UInt64)) Engine=TinyLog();
|
||||||
|
INSERT INTO dist_00967 SELECT toUInt64(number) FROM system.numbers LIMIT 1; -- { serverError 171; }
|
||||||
|
|
||||||
|
SELECT * FROM dist_00967;
|
Loading…
Reference in New Issue
Block a user