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

Method execute

src/DataStreams/TTLDeleteAlgorithm.cpp:17–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17void TTLDeleteAlgorithm::execute(Block & block)
18{
19 if (!block || !isMinTTLExpired())
20 return;
21
22 auto ttl_column = executeExpressionAndGetColumn(description.expression, block, description.result_column);
23 auto where_column = executeExpressionAndGetColumn(description.where_expression, block, description.where_result_column);
24
25 MutableColumns result_columns;
26 const auto & column_names = block.getNames();
27
28 result_columns.reserve(column_names.size());
29 for (auto it = column_names.begin(); it != column_names.end(); ++it)
30 {
31 const IColumn * values_column = block.getByName(*it).column.get();
32 MutableColumnPtr result_column = values_column->cloneEmpty();
33 result_column->reserve(block.rows());
34
35 for (size_t i = 0; i < block.rows(); ++i)
36 {
37 UInt32 cur_ttl = getTimestampByIndex(ttl_column.get(), i);
38 bool where_filter_passed = !where_column || where_column->getBool(i);
39
40 if (!isTTLExpired(cur_ttl) || !where_filter_passed)
41 {
42 new_ttl_info.update(cur_ttl);
43 result_column->insertFrom(*values_column, i);
44 }
45 else if (it == column_names.begin())
46 ++rows_removed;
47 }
48
49 result_columns.emplace_back(std::move(result_column));
50 }
51
52 block = block.cloneWithColumns(std::move(result_columns));
53}
54
55void TTLDeleteAlgorithm::finalize(const MutableDataPartPtr & data_part) const
56{

Callers

nothing calls this directly

Calls 14

getByNameMethod · 0.80
cloneWithColumnsMethod · 0.80
getNamesMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
cloneEmptyMethod · 0.45
rowsMethod · 0.45
getBoolMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected