Skip to content
Merged
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
31 changes: 25 additions & 6 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,20 +976,39 @@ impl LogicalPlan {
/// .filter(col("id").eq(placeholder("$1"))).unwrap()
/// .build().unwrap();
///
/// assert_eq!("Filter: t1.id = $1\
/// \n TableScan: t1",
/// plan.display_indent().to_string()
/// assert_eq!(
/// "Filter: t1.id = $1\
/// \n TableScan: t1",
/// plan.display_indent().to_string()
/// );
///
/// // Fill in the parameter $1 with a literal 3
/// let plan = plan.with_param_values(vec![
/// ScalarValue::from(3i32) // value at index 0 --> $1
/// ]).unwrap();
///
/// assert_eq!("Filter: t1.id = Int32(3)\
/// \n TableScan: t1",
/// plan.display_indent().to_string()
/// assert_eq!(
/// "Filter: t1.id = Int32(3)\
/// \n TableScan: t1",
/// plan.display_indent().to_string()
/// );
///
/// // Note you can also used named parameters
/// // Build SELECT * FROM t1 WHRERE id = $my_param
/// let plan = table_scan(Some("t1"), &schema, None).unwrap()
/// .filter(col("id").eq(placeholder("$my_param"))).unwrap()
/// .build().unwrap()
/// // Fill in the parameter $my_param with a literal 3
/// .with_param_values(vec![
/// ("my_param", ScalarValue::from(3i32)),
/// ]).unwrap();
///
/// assert_eq!(
/// "Filter: t1.id = Int32(3)\
/// \n TableScan: t1",
/// plan.display_indent().to_string()
/// );
///
/// ```
pub fn with_param_values(
self,
Expand Down