@@ -27,6 +27,9 @@ struct LightChunk
2727 void concat (const LightChunk & other)
2828 {
2929 auto added_rows = other.rows ();
30+ if (added_rows <= 0 )
31+ return ;
32+
3033 assert (columns () == other.columns ());
3134 for (size_t c = 0 ; auto & col : data)
3235 {
@@ -35,9 +38,21 @@ struct LightChunk
3538 }
3639 }
3740
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+
3852 size_t rows () const noexcept { return data.empty () ? 0 : data[0 ]->size (); }
3953 size_t columns () const noexcept { return data.size (); }
4054
55+ Columns & getColumns () noexcept { return data; }
4156 const Columns & getColumns () const noexcept { return data; }
4257 Columns detachColumns () noexcept { return std::move (data); }
4358
@@ -88,7 +103,9 @@ struct LightChunkWithTimestamp
88103 LightChunkWithTimestamp () = default ;
89104 LightChunkWithTimestamp (Columns && data_) : chunk(std::move(data_)) { }
90105 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+ }
92109 LightChunkWithTimestamp (const Block & block)
93110 : chunk(block), min_timestamp(block.minTimestamp()), max_timestamp(block.maxTimestamp()) { }
94111
@@ -122,4 +139,4 @@ struct LightChunkWithTimestamp
122139 Int64 maxTimestamp () const noexcept { return max_timestamp; }
123140};
124141
125- }
142+ }
0 commit comments