Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions rust/common/src/vector_op/agg/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@ use crate::array::Array;
/// shorten the `where` clause of `GeneralAgg`, but to workaround an compiler
/// error[E0582]: binding for associated type `Output` references lifetime `'a`,
/// which does not appear in the trait input types.
pub trait RTFn<'a, T, R>:
Fn(Option<R::RefItem<'a>>, Option<T::RefItem<'a>>) -> Option<R::RefItem<'a>>
pub trait RTFn<'a, T, R> = Send
+ 'static
+ Fn(
Option<<R as Array>::RefItem<'a>>,
Option<<T as Array>::RefItem<'a>>,
) -> Option<<R as Array>::RefItem<'a>>
where
T: Array,
R: Array,
{
}

impl<'a, T, R, Z> RTFn<'a, T, R> for Z
where
T: Array,
R: Array,
Z: Fn(Option<R::RefItem<'a>>, Option<T::RefItem<'a>>) -> Option<R::RefItem<'a>>,
{
}
R: Array;

use std::convert::From;
use std::ops::Add;
Expand Down
6 changes: 3 additions & 3 deletions rust/common/src/vector_op/agg/general_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::vector_op::agg::general_sorted_grouper::EqGroups;
pub struct GeneralAgg<T, F, R>
where
T: Array,
F: Send + for<'a> RTFn<'a, T, R>,
F: for<'a> RTFn<'a, T, R>,
R: Array,
{
return_type: DataType,
Expand All @@ -22,7 +22,7 @@ where
impl<T, F, R> GeneralAgg<T, F, R>
where
T: Array,
F: Send + for<'a> RTFn<'a, T, R>,
F: for<'a> RTFn<'a, T, R>,
R: Array,
{
pub fn new(return_type: DataType, input_col_idx: usize, f: F) -> Self {
Expand Down Expand Up @@ -78,7 +78,7 @@ macro_rules! impl_aggregator {
($input:ty, $input_variant:ident, $result:ty, $result_variant:ident) => {
impl<F> Aggregator for GeneralAgg<$input, F, $result>
where
F: 'static + Send + for<'a> RTFn<'a, $input, $result>,
F: for<'a> RTFn<'a, $input, $result>,
{
fn return_type(&self) -> DataType {
self.return_type.clone()
Expand Down
6 changes: 3 additions & 3 deletions rust/common/src/vector_op/agg/general_distinct_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::vector_op::agg::general_sorted_grouper::EqGroups;
pub struct GeneralDistinctAgg<T, F, R>
where
T: Array,
F: Send + for<'a> RTFn<'a, T, R>,
F: for<'a> RTFn<'a, T, R>,
R: Array,
{
return_type: DataType,
Expand All @@ -30,7 +30,7 @@ where
impl<T, F, R> GeneralDistinctAgg<T, F, R>
where
T: Array,
F: Send + for<'a> RTFn<'a, T, R>,
F: for<'a> RTFn<'a, T, R>,
R: Array,
{
pub fn new(return_type: DataType, input_col_idx: usize, f: F) -> Self {
Expand Down Expand Up @@ -102,7 +102,7 @@ macro_rules! impl_aggregator {
($input:ty, $input_variant:ident, $result:ty, $result_variant:ident) => {
impl<F> Aggregator for GeneralDistinctAgg<$input, F, $result>
where
F: 'static + Send + for<'a> RTFn<'a, $input, $result>,
F: for<'a> RTFn<'a, $input, $result>,
{
fn return_type(&self) -> DataType {
self.return_type.clone()
Expand Down