1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct StatsSettings {
#[buffalo(id = 0, required)]
pub number_histogram_max_size: u64,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "static", value_size = 8)]
pub enum ColumnStats {
#[buffalo(id = 0)]
UnknownColumn(UnknownColumnStats),
#[buffalo(id = 1)]
NumberColumn(NumberColumnStats),
#[buffalo(id = 2)]
EnumColumn(EnumColumnStats),
#[buffalo(id = 3)]
TextColumn(TextColumnStats),
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct UnknownColumnStats {
#[buffalo(id = 0, required)]
pub column_name: String,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct NumberColumnStats {
#[buffalo(id = 0, required)]
pub column_name: String,
#[buffalo(id = 1, required)]
pub invalid_count: u64,
#[buffalo(id = 2, required)]
pub unique_count: u64,
#[buffalo(id = 3, required)]
pub histogram: Option<Vec<(f32, u64)>>,
#[buffalo(id = 4, required)]
pub min: f32,
#[buffalo(id = 5, required)]
pub max: f32,
#[buffalo(id = 6, required)]
pub mean: f32,
#[buffalo(id = 7, required)]
pub variance: f32,
#[buffalo(id = 8, required)]
pub std: f32,
#[buffalo(id = 9, required)]
pub p25: f32,
#[buffalo(id = 10, required)]
pub p50: f32,
#[buffalo(id = 11, required)]
pub p75: f32,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct EnumColumnStats {
#[buffalo(id = 0, required)]
pub column_name: String,
#[buffalo(id = 1, required)]
pub invalid_count: u64,
#[buffalo(id = 2, required)]
pub histogram: Vec<(String, u64)>,
#[buffalo(id = 3, required)]
pub unique_count: u64,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct TextColumnStats {
#[buffalo(id = 0, required)]
pub column_name: String,
#[buffalo(id = 1, required)]
pub tokenizer: Tokenizer,
#[buffalo(id = 2, required)]
pub ngram_types: Vec<NGramType>,
#[buffalo(id = 3, required)]
pub ngrams_count: u64,
#[buffalo(id = 4, required)]
pub top_ngrams: Vec<(NGram, TextColumnStatsTopNGramsEntry)>,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct Tokenizer {
#[buffalo(id = 0, required)]
pub lowercase: bool,
#[buffalo(id = 1, required)]
pub alphanumeric: bool,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub struct TextColumnStatsTopNGramsEntry {
#[buffalo(id = 0, required)]
pub row_count: u64,
#[buffalo(id = 1, required)]
pub occurrence_count: u64,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "static", value_size = 0)]
pub enum NGramType {
#[buffalo(id = 0)]
Unigram,
#[buffalo(id = 1)]
Bigram,
}
#[derive(buffalo::Read, buffalo::Write)]
#[buffalo(size = "dynamic")]
pub enum NGram {
#[buffalo(id = 0)]
Unigram(String),
#[buffalo(id = 1)]
Bigram((String, String)),
}