Skip to content
Snippets Groups Projects
Commit af77c87d authored by Maaz Ahmed's avatar Maaz Ahmed
Browse files

Merge branch '28-bug-lifetime-constraints-causing-errors-while-combining-functions' into 'main'

Resolve "Bug: lifetime constraints causing errors while combining functions"

Closes #28

See merge request !16
parents 2040a40a e25bd94a
No related branches found
No related tags found
1 merge request!16Resolve "Bug: lifetime constraints causing errors while combining functions"
Pipeline #14554 passed with stages
in 2 minutes and 17 seconds
......@@ -66,7 +66,7 @@ impl<F: Fn(&mut fmt::Formatter) -> fmt::Result> IntoQuery for AggrFunc<'_, F> {
/// The sum aggregate operator/function
#[inline]
pub fn sum<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("sum", vec_expr).into()
}
......@@ -74,7 +74,7 @@ pub fn sum<'a>(
/// The min aggregate operator/function
#[inline]
pub fn min<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("min", vec_expr).into()
}
......@@ -82,7 +82,7 @@ pub fn min<'a>(
/// The max aggregate operator/function
#[inline]
pub fn max<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("max", vec_expr).into()
}
......@@ -90,7 +90,7 @@ pub fn max<'a>(
/// The avg aggregate operator/function
#[inline]
pub fn avg<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("avg", vec_expr).into()
}
......@@ -98,7 +98,7 @@ pub fn avg<'a>(
/// The group aggregate operator/function
#[inline]
pub fn group<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("group", vec_expr).into()
}
......@@ -106,7 +106,7 @@ pub fn group<'a>(
/// The stddev aggregate operator/function
#[inline]
pub fn stddev<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("stddev", vec_expr).into()
}
......@@ -114,7 +114,7 @@ pub fn stddev<'a>(
/// The stdvar aggregate operator/function
#[inline]
pub fn stdvar<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("stdvar", vec_expr).into()
}
......@@ -122,7 +122,7 @@ pub fn stdvar<'a>(
/// The count aggregate operator/function
#[inline]
pub fn count<'a>(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("count", vec_expr).into()
}
......@@ -130,9 +130,9 @@ pub fn count<'a>(
/// The count_values aggregate operator/function
#[inline]
pub fn count_values<'a>(
label: &'_ str,
vec_expr: impl Operable + 'static,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result + '_> {
label: &'a str,
vec_expr: impl Operable + 'a,
) -> AggrFunc<'_, impl Fn(&mut fmt::Formatter) -> fmt::Result + '_> {
qry_fn!(count_values, r#""{label}", {vec_expr}"#).into()
}
......@@ -140,7 +140,7 @@ pub fn count_values<'a>(
#[inline]
pub fn topk<'a>(
k: usize,
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(topk, "{k}, {vec_expr}").into()
}
......@@ -149,7 +149,7 @@ pub fn topk<'a>(
#[inline]
pub fn bottomk<'a>(
k: usize,
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(bottomk, "{k}, {vec_expr}").into()
}
......@@ -158,7 +158,7 @@ pub fn bottomk<'a>(
#[inline]
pub fn quantile<'a>(
phi: f32,
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
) -> AggrFunc<'a, impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(quantile, "{phi}, {vec_expr}").into()
}
......
......@@ -78,8 +78,8 @@ impl<F: Fn(&mut fmt::Formatter) -> fmt::Result> IntoQuery for QryFunc<F> {
#[inline]
fn basic_fn(
name: &'static str,
expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result + '_> {
expr: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(var: name, "{expr}")
}
......
......@@ -7,7 +7,7 @@ use super::{basic_fn, qry_fn, QryFunc};
/// The avg_over_time rollup query function
#[inline]
pub fn avg_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("avg_over_time", range_vec)
}
......@@ -15,7 +15,7 @@ pub fn avg_over_time(
/// The min_over_time rollup query function
#[inline]
pub fn min_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("min_over_time", range_vec)
}
......@@ -23,7 +23,7 @@ pub fn min_over_time(
/// The max_over_time rollup query function
#[inline]
pub fn max_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("max_over_time", range_vec)
}
......@@ -31,7 +31,7 @@ pub fn max_over_time(
/// The sum_over_time rollup query function
#[inline]
pub fn sum_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("sum_over_time", range_vec)
}
......@@ -39,7 +39,7 @@ pub fn sum_over_time(
/// The count_over_time rollup query function
#[inline]
pub fn count_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("count_over_time", range_vec)
}
......@@ -48,7 +48,7 @@ pub fn count_over_time(
#[inline]
pub fn quantile_over_time(
phi: f32,
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(quantile_over_time, "{phi},{range_vec}")
}
......@@ -56,7 +56,7 @@ pub fn quantile_over_time(
/// The stddev_over_time rollup query function
#[inline]
pub fn stddev_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("stddev_over_time", range_vec)
}
......@@ -64,7 +64,7 @@ pub fn stddev_over_time(
/// The stdvar_over_time rollup query function
#[inline]
pub fn stdvar_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("stdvar_over_time", range_vec)
}
......@@ -72,7 +72,7 @@ pub fn stdvar_over_time(
/// The present_over_time rollup query function
#[inline]
pub fn present_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("present_over_time", range_vec)
}
......@@ -80,7 +80,7 @@ pub fn present_over_time(
/// The last_over_time rollup query function
#[inline]
pub fn last_over_time(
range_vec: impl Operable + 'static,
range_vec: impl Operable,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("last_over_time", range_vec)
}
......
......@@ -32,7 +32,7 @@ pub fn mql_union(
/// The `round` query transform function
pub fn round(
vec_expr: impl Operable + 'static,
vec_expr: impl Operable,
nearest: Option<f64>,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(round, {
......@@ -46,70 +46,50 @@ pub fn round(
}
/// The `abs` query transform function
pub fn abs(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn abs(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(abs, "{vec_expr}")
}
/// The `absent` query transform function
pub fn absent(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn absent(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(absent, "{vec_expr}")
}
/// The `ceil` query transform function
pub fn ceil(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn ceil(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(ceil, "{vec_expr}")
}
/// The `changes` query transform function
pub fn changes(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn changes(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(changes, "{vec_expr}")
}
/// The `delta` query transform function
pub fn delta(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn delta(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(delta, "{vec_expr}")
}
/// The `exp` query transform function
pub fn exp(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn exp(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(exp, "{vec_expr}")
}
/// The `floor` query transform function
pub fn floor(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn floor(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(floor, "{vec_expr}")
}
/// The `sort` query transform function
pub fn sort(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn sort(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(sort, "{vec_expr}")
}
/// The `sort_desc` query transform function
pub fn sort_desc(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn sort_desc(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(sort_desc, "{vec_expr}")
}
/// The `sqrt` query transform function
pub fn sqrt(
vec_expr: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
pub fn sqrt(vec_expr: impl Operable) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
qry_fn!(sqrt, "{vec_expr}")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment