Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
improve documentation strings
  • Loading branch information
alamb committed Jul 3, 2024
commit 3da39fda9c822744885c10cb83c894c99f59c4fa
25 changes: 18 additions & 7 deletions datafusion/expr/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ pub trait ContextProvider {

/// This trait allows users to customize the behavior of the SQL planner
pub trait UserDefinedSQLPlanner: Send + Sync {
/// Plan the binary operation between two expressions, returns OriginalBinaryExpr if not possible
/// Plan the binary operation between two expressions, returns original
/// BinaryExpr if not possible
fn plan_binary_op(
&self,
expr: RawBinaryExpr,
Expand All @@ -93,7 +94,9 @@ pub trait UserDefinedSQLPlanner: Send + Sync {
Ok(PlannerResult::Original(expr))
}

/// Plan the field access expression, returns OriginalFieldAccessExpr if not possible
/// Plan the field access expression
///
/// returns original FieldAccessExpr if not possible
fn plan_field_access(
&self,
expr: RawFieldAccessExpr,
Expand All @@ -102,7 +105,9 @@ pub trait UserDefinedSQLPlanner: Send + Sync {
Ok(PlannerResult::Original(expr))
}

// Plan the array literal, returns OriginalArray if not possible
/// Plan the array literal, returns OriginalArray if not possible
///
/// Returns origin expression arguments if not possible
fn plan_array_literal(
&self,
exprs: Vec<Expr>,
Expand All @@ -111,7 +116,9 @@ pub trait UserDefinedSQLPlanner: Send + Sync {
Ok(PlannerResult::Original(exprs))
}

// Plan the dictionaray literal { key: value, ...}
/// Plan the dictionary literal `{ key: value, ...}`
///
/// Returns origin expression arguments if not possible
fn plan_dictionary_literal(
&self,
expr: RawDictionaryExpr,
Expand All @@ -120,8 +127,9 @@ pub trait UserDefinedSQLPlanner: Send + Sync {
Ok(PlannerResult::Original(expr))
}

// Plan the Extract expression, e.g., EXTRACT(month FROM foo)
// returns origin expression arguments if not possible
/// Plan an extract expression, e.g., `EXTRACT(month FROM foo)`
///
/// Returns origin expression arguments if not possible
fn plan_extract(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> {
Ok(PlannerResult::Original(args))
}
Expand Down Expand Up @@ -151,7 +159,10 @@ pub struct RawFieldAccessExpr {
pub expr: Expr,
}

/// A dictionary expression { key: value, ...}
/// A Dictionary literal expression `{ key: value, ...}`
///
/// This structure is used by [`UserDefinedSQLPlanner`] to plan operators with
/// custom expressions.
#[derive(Debug, Clone)]
pub struct RawDictionaryExpr {
pub keys: Vec<Expr>,
Expand Down