vortex_compressor/stats/options.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! Compression statistics types.
5
6/// Configures how stats are generated.
7///
8/// Each scheme declares its required options via [`Scheme::stats_options`]. The compressor
9/// merges all eligible schemes' options before generating stats, so that a single stats pass
10/// satisfies every scheme.
11///
12/// [`Scheme::stats_options`]: crate::scheme::Scheme::stats_options
13#[derive(Debug, Default, Clone, Copy)]
14pub struct GenerateStatsOptions {
15 /// Whether distinct values should be counted during stats generation.
16 pub count_distinct_values: bool,
17}
18
19impl GenerateStatsOptions {
20 /// Merges two options by OR-ing each field. The result enables a stat if either input does.
21 pub fn merge(self, other: Self) -> Self {
22 Self {
23 count_distinct_values: self.count_distinct_values || other.count_distinct_values,
24 }
25 }
26}