use chrono::{DateTime, Utc};
use crate::column_types::models::ColumnType;
use crate::project::models::BatchStep;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorWindow {
pub from: Option<String>,
pub to: Option<String>,
pub inclusive: bool,
}
#[derive(Debug, Clone, Copy)]
pub struct WindowSplit<'a> {
pub from: Option<&'a str>,
pub to: Option<&'a str>,
pub inclusive: bool,
pub step: BatchStep,
pub cursor_type: Option<&'a ColumnType>,
pub now: DateTime<Utc>,
pub zone: chrono_tz::Tz,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FileGroup {
pub files: Vec<usize>,
pub values: Vec<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WindowStep {
Days(i64),
Micros {
micros: i64,
zoned: bool,
},
Integer(i128),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WindowPlan {
pub start: String,
pub end: String,
pub step: WindowStep,
pub inclusive: bool,
pub count: u64,
}
#[derive(Debug, Clone, Default)]
pub struct OutsideRows {
pub before: u64,
pub after: u64,
pub earliest: Option<arrow_array::ArrayRef>,
pub latest: Option<arrow_array::ArrayRef>,
pub first: Option<(u64, arrow_array::ArrayRef)>,
}
impl OutsideRows {
pub fn count(&self) -> u64 {
self.before + self.after
}
}
#[derive(Debug, Clone)]
pub struct WindowRows {
pub kept: arrow_array::RecordBatch,
pub nulls: usize,
pub outside: OutsideRows,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OutsideCause {
WholeDay { day: String, after: bool },
WholeDays { first: String, last: String },
AtBound { after: bool },
Offset { half_hours: i64, after: bool },
NoEnd,
Unfiltered,
}