@@ -27,6 +27,9 @@ struct LightChunk
27
27
void concat (const LightChunk & other)
28
28
{
29
29
auto added_rows = other.rows ();
30
+ if (added_rows <= 0 )
31
+ return ;
32
+
30
33
assert (columns () == other.columns ());
31
34
for (size_t c = 0 ; auto & col : data)
32
35
{
@@ -35,9 +38,21 @@ struct LightChunk
35
38
}
36
39
}
37
40
41
+ LightChunk cloneEmpty () const
42
+ {
43
+ LightChunk res;
44
+ res.data .reserve (data.size ());
45
+
46
+ for (const auto & elem : data)
47
+ res.data .emplace_back (elem->cloneEmpty ());
48
+
49
+ return res;
50
+ }
51
+
38
52
size_t rows () const noexcept { return data.empty () ? 0 : data[0 ]->size (); }
39
53
size_t columns () const noexcept { return data.size (); }
40
54
55
+ Columns & getColumns () noexcept { return data; }
41
56
const Columns & getColumns () const noexcept { return data; }
42
57
Columns detachColumns () noexcept { return std::move (data); }
43
58
@@ -88,7 +103,9 @@ struct LightChunkWithTimestamp
88
103
LightChunkWithTimestamp () = default ;
89
104
LightChunkWithTimestamp (Columns && data_) : chunk(std::move(data_)) { }
90
105
LightChunkWithTimestamp (Chunk && chunk_, Int64 min_ts, Int64 max_ts)
91
- : chunk(std::move(chunk_)), min_timestamp(min_ts), max_timestamp(max_ts) { }
106
+ : chunk(std::move(chunk_)), min_timestamp(min_ts), max_timestamp(max_ts)
107
+ {
108
+ }
92
109
LightChunkWithTimestamp (const Block & block)
93
110
: chunk(block), min_timestamp(block.minTimestamp()), max_timestamp(block.maxTimestamp()) { }
94
111
@@ -122,4 +139,4 @@ struct LightChunkWithTimestamp
122
139
Int64 maxTimestamp () const noexcept { return max_timestamp; }
123
140
};
124
141
125
- }
142
+ }
0 commit comments