pub struct DuckDbQueryAdapter { /* private fields */ }Expand description
Generates DuckDB-compatible SQL queries over exported Parquet files.
This adapter does not embed DuckDB as a dependency; instead it produces SQL strings that can be sent to an external DuckDB process or connection pool.
Implementations§
Source§impl DuckDbQueryAdapter
impl DuckDbQueryAdapter
Sourcepub fn new(path: impl Into<String>) -> Self
pub fn new(path: impl Into<String>) -> Self
Create an adapter for a Parquet file or glob (e.g. /data/*.parquet).
Sourcepub fn parquet_path(&self) -> &str
pub fn parquet_path(&self) -> &str
Return the configured Parquet path / glob.
Sourcepub fn select_metric(&self, metric: &str, start_ms: i64, end_ms: i64) -> String
pub fn select_metric(&self, metric: &str, start_ms: i64, end_ms: i64) -> String
Generate SQL to select all rows for a specific metric within a time range.
Sourcepub fn aggregate_metric(
&self,
metric: &str,
start_ms: i64,
end_ms: i64,
aggregation: AggregationFunction,
) -> String
pub fn aggregate_metric( &self, metric: &str, start_ms: i64, end_ms: i64, aggregation: AggregationFunction, ) -> String
Generate SQL to compute per-metric aggregates over a time range.
Sourcepub fn resample(&self, metric: &str, bucket_ms: i64) -> String
pub fn resample(&self, metric: &str, bucket_ms: i64) -> String
Generate SQL to downsample data into fixed-width time buckets (ms).
Sourcepub fn export_query_to_parquet(&self, query: &str, output_path: &str) -> String
pub fn export_query_to_parquet(&self, query: &str, output_path: &str) -> String
Generate SQL to export query results back to another Parquet file.
Sourcepub fn list_metrics(&self) -> String
pub fn list_metrics(&self) -> String
Generate SQL to list distinct metrics in the dataset.
Sourcepub fn time_range_summary(&self) -> String
pub fn time_range_summary(&self) -> String
Generate SQL to compute a time-range summary for all metrics.
Sourcepub fn join_metrics(
&self,
metric_a: &str,
metric_b: &str,
bucket_ms: i64,
) -> String
pub fn join_metrics( &self, metric_a: &str, metric_b: &str, bucket_ms: i64, ) -> String
Generate SQL to join two metric time-series by timestamp bucket.
Sourcepub fn rate_of_change(&self, metric: &str, bucket_ms: i64) -> String
pub fn rate_of_change(&self, metric: &str, bucket_ms: i64) -> String
Generate SQL to compute rate of change (derivative) per bucket.
Sourcepub fn create_view(&self, view_name: &str) -> String
pub fn create_view(&self, view_name: &str) -> String
Generate SQL to create a DuckDB view for repeated queries.
Sourcepub fn count_per_metric(&self) -> String
pub fn count_per_metric(&self) -> String
Generate SQL to count total data points per metric.
Trait Implementations§
Source§impl Clone for DuckDbQueryAdapter
impl Clone for DuckDbQueryAdapter
Source§fn clone(&self) -> DuckDbQueryAdapter
fn clone(&self) -> DuckDbQueryAdapter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DuckDbQueryAdapter
impl RefUnwindSafe for DuckDbQueryAdapter
impl Send for DuckDbQueryAdapter
impl Sync for DuckDbQueryAdapter
impl Unpin for DuckDbQueryAdapter
impl UnsafeUnpin for DuckDbQueryAdapter
impl UnwindSafe for DuckDbQueryAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more