Fixing compilation errors.

This commit is contained in:
Vitaliy Zakaznikov 2020-01-02 20:31:04 +01:00
parent d43eae2db8
commit 2c4bf0581f
2 changed files with 14 additions and 3 deletions

View File

@ -97,6 +97,11 @@ static void extractDependentTable(ASTPtr & query, String & select_database_name,
BlocksPtrs StorageLiveView::collectMergeableBlocks(const Context & context) BlocksPtrs StorageLiveView::collectMergeableBlocks(const Context & context)
{ {
ASTPtr mergeable_query = inner_query;
if (inner_subquery)
mergeable_query = inner_subquery;
BlocksPtrs new_mergeable_blocks = std::make_shared<std::vector<BlocksPtr>>(); BlocksPtrs new_mergeable_blocks = std::make_shared<std::vector<BlocksPtr>>();
BlocksPtr base_mergeable_blocks = std::make_shared<Blocks>(); BlocksPtr base_mergeable_blocks = std::make_shared<Blocks>();
@ -110,9 +115,11 @@ BlocksPtrs StorageLiveView::collectMergeableBlocks(const Context & context)
new_mergeable_blocks->push_back(base_mergeable_blocks); new_mergeable_blocks->push_back(base_mergeable_blocks);
mergeable_blocks = new_mergeable_blocks; mergeable_blocks = new_mergeable_blocks;
return mergeable_blocks;
} }
BlockInputStreams blocksToInputStreams(BlocksPtrs blocks) BlockInputStreams StorageLiveView::blocksToInputStreams(BlocksPtrs blocks)
{ {
BlockInputStreams streams; BlockInputStreams streams;
@ -131,7 +138,7 @@ BlockInputStreams blocksToInputStreams(BlocksPtrs blocks)
} }
/// Complete query using input streams from mergeable blocks /// Complete query using input streams from mergeable blocks
BlockInputStreamPtr StorageLiveView::completeQuery(BlockInputStreams from) BlockInputStreamPtr StorageLiveView::completeQuery(BlockInputStreams & from)
{ {
auto block_context = std::make_unique<Context>(global_context); auto block_context = std::make_unique<Context>(global_context);
block_context->makeQueryContext(); block_context->makeQueryContext();
@ -224,7 +231,7 @@ void StorageLiveView::writeIntoLiveView(
} }
} }
BlockInputStreamPtr data = completeQuery(std::move(from)); BlockInputStreamPtr data = live_view.completeQuery(from);
copyData(*data, *output); copyData(*data, *output);
} }

View File

@ -140,8 +140,12 @@ public:
std::shared_ptr<BlocksPtr> getBlocksPtr() { return blocks_ptr; } std::shared_ptr<BlocksPtr> getBlocksPtr() { return blocks_ptr; }
BlocksPtrs getMergeableBlocks() { return mergeable_blocks; } BlocksPtrs getMergeableBlocks() { return mergeable_blocks; }
/// collect and set mergeable blocks. Must be called holding mutex /// collect and set mergeable blocks. Must be called holding mutex
BlocksPtrs collectMergeableBlocks(const Context & context); BlocksPtrs collectMergeableBlocks(const Context & context);
/// Complete query using input streams from mergeable blocks
BlockInputStreamPtr completeQuery(BlockInputStreams & from);
void setMergeableBlocks(BlocksPtrs blocks) { mergeable_blocks = blocks; } void setMergeableBlocks(BlocksPtrs blocks) { mergeable_blocks = blocks; }
std::shared_ptr<bool> getActivePtr() { return active_ptr; } std::shared_ptr<bool> getActivePtr() { return active_ptr; }