#![allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
use std::cell::Cell;
use std::collections::BTreeMap;
use std::sync::Arc;
use uqa_core::{IndexStats, Predicate, Value};
use uqa_operators::{
DeepFusionLayer, GraphPatternIR, MultiStageCutoff, OperatorTree, ProbBoolMode,
TemporalFilterIR, VertexConstraint,
};
use uqa_sql::ast::{BinaryOp, Expr};
mod ast_helpers;
mod config;
mod cross_paradigm;
mod entropy;
mod filter;
mod graph;
mod join;
mod operator;
mod relational;
mod rpq_complexity;
mod sampling_rng;
mod stats;
pub use entropy::{column_entropy, entropy_cardinality_lower_bound, mutual_information_estimate};
pub use stats::{
AccessParadigm, ColumnStats, EdgeSample, GraphStats, GraphStoreSampler, LocalAccessEstimate,
RelationStats, Selectivity, GRAPH_AVG_DEGREE_DEFAULT, JACCARD_JOIN_SELECTIVITY,
};
use ast_helpers::{
column_of, compare_values, histogram_range_selectivity, literal_of, value_as_f64,
};
use rpq_complexity::rpq_label_count;
use sampling_rng::XorShiftRng;
#[derive(Clone, Default)]
pub struct CardinalityEstimator {
pub default_selectivity: f64,
pub like_selectivity: f64,
pub range_selectivity: f64,
pub column_stats: BTreeMap<String, ColumnStats>,
pub graph_stats: Option<GraphStats>,
pub graph_store: Option<Arc<dyn GraphStoreSampler>>,
}
#[cfg(test)]
mod tests;