mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix header for MergeJoin with constants.
This commit is contained in:
parent
c2d079d40e
commit
87246ea91b
@ -501,6 +501,7 @@ void MergeJoin::joinTotals(Block & block) const
|
||||
|
||||
void MergeJoin::mergeRightBlocks()
|
||||
{
|
||||
std::cerr << "=========== Merging right blocks in_mem " << is_in_memory << std::endl;
|
||||
if (is_in_memory)
|
||||
mergeInMemoryRightBlocks();
|
||||
else
|
||||
@ -930,7 +931,7 @@ std::shared_ptr<Block> MergeJoin::loadRightBlock(size_t pos) const
|
||||
{
|
||||
auto load_func = [&]() -> std::shared_ptr<Block>
|
||||
{
|
||||
TemporaryFileStream input(flushed_right_blocks[pos]->path(), right_sample_block);
|
||||
TemporaryFileStream input(flushed_right_blocks[pos]->path(), materializeBlock(right_sample_block));
|
||||
return std::make_shared<Block>(input.block_in->read());
|
||||
};
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <DataStreams/MergingSortedBlockInputStream.h>
|
||||
#include <DataStreams/OneBlockInputStream.h>
|
||||
#include <DataStreams/TemporaryFileStream.h>
|
||||
#include <DataStreams/materializeBlock.h>
|
||||
#include <Disks/StoragePolicy.h>
|
||||
|
||||
namespace DB
|
||||
@ -198,7 +199,7 @@ SortedBlocksWriter::SortedFiles SortedBlocksWriter::finishMerge(std::function<vo
|
||||
|
||||
BlockInputStreamPtr SortedBlocksWriter::streamFromFile(const TmpFilePtr & file) const
|
||||
{
|
||||
return std::make_shared<TemporaryFileLazyInputStream>(file->path(), sample_block);
|
||||
return std::make_shared<TemporaryFileLazyInputStream>(file->path(), materializeBlock(sample_block));
|
||||
}
|
||||
|
||||
String SortedBlocksWriter::getPath() const
|
||||
|
@ -0,0 +1,5 @@
|
||||
┌─[1ma[0m─┬──────────[1mb[0m─┬─[1mc[0m─┬──────────[1md[0m─┬─[1mt2.'0.10'[0m─┐
|
||||
│ a │ 2018-01-01 │ │ 1970-01-01 │ │
|
||||
│ b │ 2018-01-01 │ B │ 2018-01-01 │ 0.10 │
|
||||
│ c │ 2018-01-01 │ C │ 2018-01-01 │ 0.10 │
|
||||
└───┴────────────┴───┴────────────┴───────────┘
|
15
tests/queries/0_stateless/01671_merge_join_and_constants.sql
Normal file
15
tests/queries/0_stateless/01671_merge_join_and_constants.sql
Normal file
@ -0,0 +1,15 @@
|
||||
DROP TABLE IF EXISTS table1;
|
||||
DROP TABLE IF EXISTS table2;
|
||||
|
||||
CREATE TABLE table1(a String, b Date) ENGINE MergeTree order by a;
|
||||
CREATE TABLE table2(c String, a String, d Date) ENGINE MergeTree order by c;
|
||||
|
||||
INSERT INTO table1 VALUES ('a', '2018-01-01') ('b', '2018-01-01') ('c', '2018-01-01');
|
||||
INSERT INTO table2 VALUES ('D', 'd', '2018-01-01') ('B', 'b', '2018-01-01') ('C', 'c', '2018-01-01');
|
||||
|
||||
set join_algorithm = 'partial_merge';
|
||||
|
||||
SELECT * FROM table1 AS t1 ALL LEFT JOIN (SELECT *, '0.10', c, d AS b FROM table2) AS t2 USING (a, b) ORDER BY d ASC FORMAT PrettyCompact settings max_rows_in_join = 1;
|
||||
|
||||
DROP TABLE IF EXISTS table1;
|
||||
DROP TABLE IF EXISTS table2;
|
Loading…
Reference in New Issue
Block a user