1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/storage/statistics/struct_stats.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/common.hpp"
12#include "duckdb/common/exception.hpp"
13
14namespace duckdb {
15class BaseStatistics;
16class FieldWriter;
17class FieldReader;
18struct SelectionVector;
19class Vector;
20
21struct StructStats {
22 DUCKDB_API static void Construct(BaseStatistics &stats);
23 DUCKDB_API static BaseStatistics CreateUnknown(LogicalType type);
24 DUCKDB_API static BaseStatistics CreateEmpty(LogicalType type);
25
26 DUCKDB_API static const BaseStatistics *GetChildStats(const BaseStatistics &stats);
27 DUCKDB_API static const BaseStatistics &GetChildStats(const BaseStatistics &stats, idx_t i);
28 DUCKDB_API static BaseStatistics &GetChildStats(BaseStatistics &stats, idx_t i);
29 DUCKDB_API static void SetChildStats(BaseStatistics &stats, idx_t i, const BaseStatistics &new_stats);
30 DUCKDB_API static void SetChildStats(BaseStatistics &stats, idx_t i, unique_ptr<BaseStatistics> new_stats);
31
32 DUCKDB_API static void Serialize(const BaseStatistics &stats, FieldWriter &writer);
33 DUCKDB_API static BaseStatistics Deserialize(FieldReader &reader, LogicalType type);
34
35 DUCKDB_API static string ToString(const BaseStatistics &stats);
36
37 DUCKDB_API static void Merge(BaseStatistics &stats, const BaseStatistics &other);
38 DUCKDB_API static void Copy(BaseStatistics &stats, const BaseStatistics &other);
39 DUCKDB_API static void Verify(const BaseStatistics &stats, Vector &vector, const SelectionVector &sel, idx_t count);
40};
41
42} // namespace duckdb
43