Skip to content

Commit ddb0e5b

Browse files
committed
add trait_variant for async return in trait
1 parent ea26467 commit ddb0e5b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

optd-types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
trait-variant = "0.1.2"

optd-types/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(unused)]
22

3-
mod expression;
4-
mod memo;
5-
mod operator;
6-
mod plan;
3+
pub mod expression;
4+
pub mod memo;
5+
pub mod operator;
6+
pub mod plan;
77

88
/// TODO make distinction between relational groups and scalar groups.
99
#[repr(transparent)]

optd-types/src/memo/rule.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::{
44
plan::{partial_logical_plan::PartialLogicalPlan, partial_physical_plan::PartialPhysicalPlan},
55
};
66

7+
#[trait_variant::make(Send)]
78
pub trait TransformationRule {
89
/// Checks if the transformation rule matches the current expression and its children.
910
/// Returns a vector of partially materialized logical plans.
@@ -15,8 +16,8 @@ pub trait TransformationRule {
1516
/// expressions `e1 = Join(Join(A, B), C)` and `e2 = Join(A, Join(B, C))`.
1617
///
1718
/// If the rule wants to match against `Filter(Join(?L, ?R))`, then this function will partially
18-
/// materialize two expressions `Filter(e1)` and `Filter(e2)`. It is then up to the [`apply`]
19-
/// function to apply modifications to the partially materialized logical plans (for example, a
19+
/// materialize two expressions `Filter(e1)` and `Filter(e2)`. It is then up to the memo table
20+
/// API to apply modifications to the partially materialized logical plans (for example, a
2021
/// filter pushdown under a `Join`).
2122
///
2223
/// TODO: Ideally this should return a `Stream` instead of a fully materialized Vector.
@@ -29,6 +30,7 @@ pub trait TransformationRule {
2930
fn apply(&self, expr: PartialLogicalPlan) -> Vec<Expr>;
3031
}
3132

33+
#[trait_variant::make(Send)]
3234
pub trait ImplementationRule {
3335
/// Checks if the implementation rule matches the current expression and its children.
3436
/// Returns a vector of partially materialized physical plans.
@@ -41,7 +43,7 @@ pub trait ImplementationRule {
4143
///
4244
/// If the rule wants to match against `Filter(HashJoin(?L, ?R))`, then this function will
4345
/// partially materialize two expressions `Filter(e1)` and `Filter(e2)`. It is then up to the
44-
/// [`apply`] function to apply modifications to the partially materialized physical plans (for
46+
/// memo table API to apply modifications to the partially materialized physical plans (for
4547
/// example, a pushing a filter predicate into the condition of the `HashJoin`).
4648
///
4749
/// TODO: Ideally this should return a `Stream` instead of a fully materialized Vector.

optd-types/src/plan/partial_logical_plan.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ pub enum LogicalLink {
5959
/// modules.
6060
///
6161
/// TODO Add detailed docs here.
62+
///
63+
/// [`LogicalPlan`]: crate::plan::logical_plan::LogicalPlan
6264
#[derive(Clone)]
6365
pub enum ScalarLink {
6466
ScalarNode(Arc<ScalarOperator<ScalarLink>>),

0 commit comments

Comments
 (0)