MCPcopy Create free account
hub / github.com/ByConity/ByConity / init

Method init

src/DataStreams/MergingSortedBlockInputStream.cpp:31–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void MergingSortedBlockInputStream::init(MutableColumns & merged_columns)
32{
33 /// Read the first blocks, initialize the queue.
34 if (first)
35 {
36 first = false;
37
38 for (size_t i = 0; i < source_blocks.size(); ++i)
39 {
40 Block & block = source_blocks[i];
41
42 if (block)
43 continue;
44
45 block = children[i]->read();
46
47 const size_t rows = block.rows();
48
49 if (rows == 0)
50 continue;
51
52 if (expected_block_size < rows)
53 expected_block_size = std::min(rows, max_block_size);
54
55 cursors[i] = SortCursorImpl(block, description, i);
56 has_collation |= cursors[i].has_collation;
57 }
58
59 if (has_collation)
60 queue_with_collation = SortingHeap<SortCursorWithCollation>(cursors);
61 else
62 queue_without_collation = SortingHeap<SortCursor>(cursors);
63 }
64
65 /// Let's check that all source blocks have the same structure.
66 for (const auto & block : source_blocks)
67 {
68 if (!block)
69 continue;
70
71 assertBlocksHaveEqualStructure(block, header, getName());
72 }
73
74 merged_columns.resize(num_columns);
75 for (size_t i = 0; i < num_columns; ++i)
76 {
77 merged_columns[i] = header.safeGetByPosition(i).column->cloneEmpty();
78 merged_columns[i]->reserve(expected_block_size);
79 }
80}
81
82
83Block MergingSortedBlockInputStream::readImpl()

Callers

nothing calls this directly

Calls 10

SortCursorImplClass · 0.85
minFunction · 0.50
getNameFunction · 0.50
sizeMethod · 0.45
readMethod · 0.45
rowsMethod · 0.45
resizeMethod · 0.45
cloneEmptyMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected