MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / internalTableFunc

Function internalTableFunc

src/function/table/stats_info.cpp:34–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32};
33
34static offset_t internalTableFunc(const TableFuncMorsel& /*morsel*/, const TableFuncInput& input,
35 DataChunk& output) {
36 const auto bindData = input.bindData->constPtrCast<StatsInfoBindData>();
37 const auto table = bindData->table;
38 switch (table->getTableType()) {
39 case TableType::NODE: {
40 const auto& nodeTable = table->cast<storage::NodeTable>();
41 const auto stats = nodeTable.getStats(transaction::Transaction::Get(*bindData->context));
42 output.getValueVectorMutable(0).setValue<cardinality_t>(0, stats.getTableCard());
43 for (auto i = 0u; i < nodeTable.getNumColumns(); ++i) {
44 output.getValueVectorMutable(i + 1).setValue(0, stats.getNumDistinctValues(i));
45 }
46 } break;
47 default: {
48 UNREACHABLE_CODE;
49 }
50 }
51 return 1;
52}
53
54static std::unique_ptr<TableFuncBindData> bindFunc(const ClientContext* context,
55 const TableFuncBindInput* input) {

Callers

nothing calls this directly

Calls 6

getTableCardMethod · 0.80
getTableTypeMethod · 0.45
getStatsMethod · 0.45
getNumColumnsMethod · 0.45
setValueMethod · 0.45
getNumDistinctValuesMethod · 0.45

Tested by

no test coverage detected