Skip to content

Apache DataFusion SQL Query Engine

ARROW-11200: [Rust] [DataFusion] Physical operators and expressions should have public accessor methods

Andy Grovedcee158cd3cd
diff --git a/rust/datafusion/src/physical_plan/coalesce_batches.rs b/rust/datafusion/src/physical_plan/coalesce_batches.rs
index 2c5209018f..1bfcf061b6 100644
--- a/rust/datafusion/src/physical_plan/coalesce_batches.rs
+++ b/rust/datafusion/src/physical_plan/coalesce_batches.rs
@@ -54,6 +54,16 @@ impl CoalesceBatchesExec {
target_batch_size,
}
}
+
+ /// The input plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
+
+ /// Minimum number of rows for coalesces batches
+ pub fn target_batch_size(&self) -> usize {
+ self.target_batch_size
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/csv.rs b/rust/datafusion/src/physical_plan/csv.rs
index 5655991287..796c3775ae 100644
--- a/rust/datafusion/src/physical_plan/csv.rs
+++ b/rust/datafusion/src/physical_plan/csv.rs
@@ -168,6 +168,41 @@ impl CsvExec {
})
}
+ /// Path to directory containing partitioned CSV files with the same schema
+ pub fn path(&self) -> &str {
+ &self.path
+ }
+
+ /// The individual files under path
+ pub fn filenames(&self) -> &[String] {
+ &self.filenames
+ }
+
+ /// Does the CSV file have a header?
+ pub fn has_header(&self) -> bool {
+ self.has_header
+ }
+
+ /// An optional column delimiter. Defaults to `b','`
+ pub fn delimiter(&self) -> Option<&u8> {
+ self.delimiter.as_ref()
+ }
+
+ /// File extension
+ pub fn file_extension(&self) -> &str {
+ &self.file_extension
+ }
+
+ /// Optional projection for which columns to load
+ pub fn projection(&self) -> Option<&Vec<usize>> {
+ self.projection.as_ref()
+ }
+
+ /// Batch size
+ pub fn batch_size(&self) -> usize {
+ self.batch_size
+ }
+
/// Infer schema for given CSV dataset
pub fn try_infer_schema(
filenames: &[String],
diff --git a/rust/datafusion/src/physical_plan/empty.rs b/rust/datafusion/src/physical_plan/empty.rs
index 0a7504ba10..3011b28950 100644
--- a/rust/datafusion/src/physical_plan/empty.rs
+++ b/rust/datafusion/src/physical_plan/empty.rs
@@ -34,7 +34,9 @@ use async_trait::async_trait;
/// Execution plan for empty relation (produces no rows)
#[derive(Debug)]
pub struct EmptyExec {
+ /// Specifies whether this exec produces a row or not
produce_one_row: bool,
+ /// The schema for the produced row
schema: SchemaRef,
}
@@ -46,6 +48,11 @@ impl EmptyExec {
schema,
}
}
+
+ /// Specifies whether this exec produces a row or not
+ pub fn produce_one_row(&self) -> bool {
+ self.produce_one_row
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/explain.rs b/rust/datafusion/src/physical_plan/explain.rs
index 40cd7065ba..56535917dd 100644
--- a/rust/datafusion/src/physical_plan/explain.rs
+++ b/rust/datafusion/src/physical_plan/explain.rs
@@ -39,7 +39,6 @@ use async_trait::async_trait;
pub struct ExplainExec {
/// The schema that this exec plan node outputs
schema: SchemaRef,
-
/// The strings to be printed
stringified_plans: Vec<StringifiedPlan>,
}
@@ -52,6 +51,11 @@ impl ExplainExec {
stringified_plans,
}
}
+
+ /// The strings to be printed
+ pub fn stringified_plans(&self) -> &[StringifiedPlan] {
+ &self.stringified_plans
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/expressions.rs b/rust/datafusion/src/physical_plan/expressions.rs
index 2b2bea43fb..3ef240dd70 100644
--- a/rust/datafusion/src/physical_plan/expressions.rs
+++ b/rust/datafusion/src/physical_plan/expressions.rs
@@ -17,6 +17,7 @@
//! Defines physical expressions that can evaluated at runtime during query execution
+use std::any::Any;
use std::convert::TryFrom;
use std::fmt;
use std::sync::Arc;
@@ -77,6 +78,11 @@ impl Column {
name: name.to_owned(),
}
}
+
+ /// Get the column name
+ pub fn name(&self) -> &str {
+ &self.name
+ }
}
impl fmt::Display for Column {
@@ -86,6 +92,11 @@ impl fmt::Display for Column {
}
impl PhysicalExpr for Column {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
/// Get the data type of this expression, given the schema of the input
fn data_type(&self, input_schema: &Schema) -> Result<DataType> {
Ok(input_schema
@@ -1154,6 +1165,21 @@ impl BinaryExpr {
) -> Self {
Self { left, op, right }
}
+
+ /// Get the left side of the binary expression
+ pub fn left(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.left
+ }
+
+ /// Get the right side of the binary expression
+ pub fn right(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.right
+ }
+
+ /// Get the operator for this binary expression
+ pub fn op(&self) -> &Operator {
+ &self.op
+ }
}
impl fmt::Display for BinaryExpr {
@@ -1399,6 +1425,11 @@ fn binary_cast(
}
impl PhysicalExpr for BinaryExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, input_schema: &Schema) -> Result<DataType> {
binary_operator_data_type(
&self.left.data_type(input_schema)?,
@@ -1615,6 +1646,7 @@ pub static SUPPORTED_NULLIF_TYPES: &[DataType] = &[
/// Not expression
#[derive(Debug)]
pub struct NotExpr {
+ /// Input expression
arg: Arc<dyn PhysicalExpr>,
}
@@ -1623,6 +1655,11 @@ impl NotExpr {
pub fn new(arg: Arc<dyn PhysicalExpr>) -> Self {
Self { arg }
}
+
+ /// Get the input expression
+ pub fn arg(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.arg
+ }
}
impl fmt::Display for NotExpr {
@@ -1632,6 +1669,11 @@ impl fmt::Display for NotExpr {
}
impl PhysicalExpr for NotExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(DataType::Boolean)
}
@@ -1691,6 +1733,7 @@ pub fn not(
/// Negative expression
#[derive(Debug)]
pub struct NegativeExpr {
+ /// Input expression
arg: Arc<dyn PhysicalExpr>,
}
@@ -1699,6 +1742,11 @@ impl NegativeExpr {
pub fn new(arg: Arc<dyn PhysicalExpr>) -> Self {
Self { arg }
}
+
+ /// Get the input expression
+ pub fn arg(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.arg
+ }
}
impl fmt::Display for NegativeExpr {
@@ -1708,6 +1756,11 @@ impl fmt::Display for NegativeExpr {
}
impl PhysicalExpr for NegativeExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, input_schema: &Schema) -> Result<DataType> {
self.arg.data_type(input_schema)
}
@@ -1767,6 +1820,7 @@ pub fn negative(
/// IS NULL expression
#[derive(Debug)]
pub struct IsNullExpr {
+ /// Input expression
arg: Arc<dyn PhysicalExpr>,
}
@@ -1775,6 +1829,11 @@ impl IsNullExpr {
pub fn new(arg: Arc<dyn PhysicalExpr>) -> Self {
Self { arg }
}
+
+ /// Get the input expression
+ pub fn arg(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.arg
+ }
}
impl fmt::Display for IsNullExpr {
@@ -1783,6 +1842,11 @@ impl fmt::Display for IsNullExpr {
}
}
impl PhysicalExpr for IsNullExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(DataType::Boolean)
}
@@ -1812,6 +1876,7 @@ pub fn is_null(arg: Arc<dyn PhysicalExpr>) -> Result<Arc<dyn PhysicalExpr>> {
/// IS NULL expression
#[derive(Debug)]
pub struct IsNotNullExpr {
+ /// The input expression
arg: Arc<dyn PhysicalExpr>,
}
@@ -1820,6 +1885,11 @@ impl IsNotNullExpr {
pub fn new(arg: Arc<dyn PhysicalExpr>) -> Self {
Self { arg }
}
+
+ /// Get the input expression
+ pub fn arg(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.arg
+ }
}
impl fmt::Display for IsNotNullExpr {
@@ -1827,7 +1897,13 @@ impl fmt::Display for IsNotNullExpr {
write!(f, "{} IS NOT NULL", self.arg)
}
}
+
impl PhysicalExpr for IsNotNullExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(DataType::Boolean)
}
@@ -1916,6 +1992,21 @@ impl CaseExpr {
})
}
}
+
+ /// Optional base expression that can be compared to literal values in the "when" expressions
+ pub fn expr(&self) -> &Option<Arc<dyn PhysicalExpr>> {
+ &self.expr
+ }
+
+ /// One or more when/then expressions
+ pub fn when_then_expr(&self) -> &[(Arc<dyn PhysicalExpr>, Arc<dyn PhysicalExpr>)] {
+ &self.when_then_expr
+ }
+
+ /// Optional "else" expression
+ pub fn else_expr(&self) -> Option<&Arc<dyn PhysicalExpr>> {
+ self.else_expr.as_ref()
+ }
}
/// Create a CASE expression
@@ -2229,6 +2320,11 @@ impl CaseExpr {
}
impl PhysicalExpr for CaseExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, input_schema: &Schema) -> Result<DataType> {
self.when_then_expr[0].1.data_type(input_schema)
}
@@ -2271,6 +2367,23 @@ pub struct CastExpr {
cast_type: DataType,
}
+impl CastExpr {
+ /// Create a new CastExpr
+ pub fn new(expr: Arc<dyn PhysicalExpr>, cast_type: DataType) -> Self {
+ Self { expr, cast_type }
+ }
+
+ /// The expression to cast
+ pub fn expr(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.expr
+ }
+
+ /// The data type to cast to
+ pub fn cast_type(&self) -> &DataType {
+ &self.cast_type
+ }
+}
+
/// Determine if a DataType is signed numeric or not
pub fn is_signed_numeric(dt: &DataType) -> bool {
matches!(
@@ -2303,6 +2416,11 @@ impl fmt::Display for CastExpr {
}
impl PhysicalExpr for CastExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(self.cast_type.clone())
}
@@ -2341,7 +2459,7 @@ pub fn cast(
if expr_type == cast_type {
Ok(expr.clone())
} else if can_cast_types(&expr_type, &cast_type) {
- Ok(Arc::new(CastExpr { expr, cast_type }))
+ Ok(Arc::new(CastExpr::new(expr, cast_type)))
} else {
Err(DataFusionError::Internal(format!(
"Unsupported CAST from {:?} to {:?}",
@@ -2361,6 +2479,11 @@ impl Literal {
pub fn new(value: ScalarValue) -> Self {
Self { value }
}
+
+ /// Get the scalar value
+ pub fn value(&self) -> &ScalarValue {
+ &self.value
+ }
}
impl fmt::Display for Literal {
@@ -2370,6 +2493,11 @@ impl fmt::Display for Literal {
}
impl PhysicalExpr for Literal {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(self.value.get_datatype())
}
@@ -2495,6 +2623,21 @@ impl InListExpr {
}
}
+ /// Input expression
+ pub fn expr(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.expr
+ }
+
+ /// List to search in
+ pub fn list(&self) -> &[Arc<dyn PhysicalExpr>] {
+ &self.list
+ }
+
+ /// Is this negated e.g. NOT IN LIST
+ pub fn negated(&self) -> bool {
+ self.negated
+ }
+
/// Compare for specific utf8 types
fn compare_utf8<T: StringOffsetSizeTrait>(
&self,
@@ -2571,6 +2714,11 @@ impl fmt::Display for InListExpr {
}
impl PhysicalExpr for InListExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(DataType::Boolean)
}
diff --git a/rust/datafusion/src/physical_plan/filter.rs b/rust/datafusion/src/physical_plan/filter.rs
index b24abc2474..1db74e1f44 100644
--- a/rust/datafusion/src/physical_plan/filter.rs
+++ b/rust/datafusion/src/physical_plan/filter.rs
@@ -63,6 +63,16 @@ impl FilterExec {
))),
}
}
+
+ /// The expression to filter on. This expression must evaluate to a boolean value.
+ pub fn predicate(&self) -> &Arc<dyn PhysicalExpr> {
+ &self.predicate
+ }
+
+ /// The input plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/functions.rs b/rust/datafusion/src/physical_plan/functions.rs
index ff88ec7173..2dc14d510f 100644
--- a/rust/datafusion/src/physical_plan/functions.rs
+++ b/rust/datafusion/src/physical_plan/functions.rs
@@ -47,7 +47,7 @@ use arrow::{
record_batch::RecordBatch,
};
use fmt::{Debug, Formatter};
-use std::{fmt, str::FromStr, sync::Arc};
+use std::{any::Any, fmt, str::FromStr, sync::Arc};
/// A function's signature, which defines the function's supported argument types.
#[derive(Debug, Clone, PartialEq)]
@@ -465,6 +465,26 @@ impl ScalarFunctionExpr {
return_type: return_type.clone(),
}
}
+
+ /// Get the scalar function implementation
+ pub fn fun(&self) -> &ScalarFunctionImplementation {
+ &self.fun
+ }
+
+ /// The name for this expression
+ pub fn name(&self) -> &str {
+ &self.name
+ }
+
+ /// Input arguments
+ pub fn args(&self) -> &[Arc<dyn PhysicalExpr>] {
+ &self.args
+ }
+
+ /// Data type produced by this expression
+ pub fn return_type(&self) -> &DataType {
+ &self.return_type
+ }
}
impl fmt::Display for ScalarFunctionExpr {
@@ -483,6 +503,11 @@ impl fmt::Display for ScalarFunctionExpr {
}
impl PhysicalExpr for ScalarFunctionExpr {
+ /// Return a reference to Any that can be used for downcasting
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
fn data_type(&self, _input_schema: &Schema) -> Result<DataType> {
Ok(self.return_type.clone())
}
diff --git a/rust/datafusion/src/physical_plan/hash_aggregate.rs b/rust/datafusion/src/physical_plan/hash_aggregate.rs
index 864bc78a15..b17b8ef609 100644
--- a/rust/datafusion/src/physical_plan/hash_aggregate.rs
+++ b/rust/datafusion/src/physical_plan/hash_aggregate.rs
@@ -64,10 +64,15 @@ pub enum AggregateMode {
/// Hash aggregate execution plan
#[derive(Debug)]
pub struct HashAggregateExec {
+ /// Aggregation mode (full, partial)
mode: AggregateMode,
+ /// Grouping expressions
group_expr: Vec<(Arc<dyn PhysicalExpr>, String)>,
+ /// Aggregate expressions
aggr_expr: Vec<Arc<dyn AggregateExpr>>,
+ /// Input plan
input: Arc<dyn ExecutionPlan>,
+ /// Schema after the aggregate is applied
schema: SchemaRef,
}
@@ -124,6 +129,26 @@ impl HashAggregateExec {
schema,
})
}
+
+ /// Aggregation mode (full, partial)
+ pub fn mode(&self) -> &AggregateMode {
+ &self.mode
+ }
+
+ /// Grouping expressions
+ pub fn group_expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)] {
+ &self.group_expr
+ }
+
+ /// Aggregate expressions
+ pub fn aggr_expr(&self) -> &[Arc<dyn AggregateExpr>] {
+ &self.aggr_expr
+ }
+
+ /// Input plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/hash_join.rs b/rust/datafusion/src/physical_plan/hash_join.rs
index a8b709d6ad..e9119bdddd 100644
--- a/rust/datafusion/src/physical_plan/hash_join.rs
+++ b/rust/datafusion/src/physical_plan/hash_join.rs
@@ -126,6 +126,26 @@ impl HashJoinExec {
})
}
+ /// left (build) side which gets hashed
+ pub fn left(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.left
+ }
+
+ /// right (probe) side which are filtered by the hash table
+ pub fn right(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.right
+ }
+
+ /// Set of common columns used to join on
+ pub fn on(&self) -> &[(String, String)] {
+ &self.on
+ }
+
+ /// How the join is performed
+ pub fn join_type(&self) -> &JoinType {
+ &self.join_type
+ }
+
/// Calculates column indices and left/right placement on input / output schemas and jointype
fn column_indices_from_schema(&self) -> ArrowResult<Vec<ColumnIndex>> {
let (primary_is_left, primary_schema, secondary_schema) = match self.join_type {
diff --git a/rust/datafusion/src/physical_plan/limit.rs b/rust/datafusion/src/physical_plan/limit.rs
index aebaf346d5..97e4eb5074 100644
--- a/rust/datafusion/src/physical_plan/limit.rs
+++ b/rust/datafusion/src/physical_plan/limit.rs
@@ -57,6 +57,16 @@ impl GlobalLimitExec {
concurrency,
}
}
+
+ /// Input execution plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
+
+ /// Maximum number of rows to return
+ pub fn limit(&self) -> usize {
+ self.limit
+ }
}
#[async_trait]
@@ -123,7 +133,9 @@ impl ExecutionPlan for GlobalLimitExec {
/// LocalLimitExec applies a limit to a single partition
#[derive(Debug)]
pub struct LocalLimitExec {
+ /// Input execution plan
input: Arc<dyn ExecutionPlan>,
+ /// Maximum number of rows to return
limit: usize,
}
@@ -132,6 +144,16 @@ impl LocalLimitExec {
pub fn new(input: Arc<dyn ExecutionPlan>, limit: usize) -> Self {
Self { input, limit }
}
+
+ /// Input execution plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
+
+ /// Maximum number of rows to return
+ pub fn limit(&self) -> usize {
+ self.limit
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/merge.rs b/rust/datafusion/src/physical_plan/merge.rs
index d0beceb9e4..51541b6c56 100644
--- a/rust/datafusion/src/physical_plan/merge.rs
+++ b/rust/datafusion/src/physical_plan/merge.rs
@@ -55,6 +55,11 @@ impl MergeExec {
pub fn new(input: Arc<dyn ExecutionPlan>) -> Self {
MergeExec { input }
}
+
+ /// Input execution plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/mod.rs b/rust/datafusion/src/physical_plan/mod.rs
index f2b984bb30..3c778da924 100644
--- a/rust/datafusion/src/physical_plan/mod.rs
+++ b/rust/datafusion/src/physical_plan/mod.rs
@@ -185,6 +185,9 @@ impl ColumnarValue {
/// Expression that can be evaluated against a RecordBatch
/// A Physical expression knows its type, nullability and how to evaluate itself.
pub trait PhysicalExpr: Send + Sync + Display + Debug {
+ /// Returns the physical expression as [`Any`](std::any::Any) so that it can be
+ /// downcast to a specific implementation.
+ fn as_any(&self) -> &dyn Any;
/// Get the data type of this expression, given the schema of the input
fn data_type(&self, input_schema: &Schema) -> Result<DataType>;
/// Determine whether this expression is nullable, given the schema of the input
diff --git a/rust/datafusion/src/physical_plan/parquet.rs b/rust/datafusion/src/physical_plan/parquet.rs
index 9a03afdf42..a92a35992a 100644
--- a/rust/datafusion/src/physical_plan/parquet.rs
+++ b/rust/datafusion/src/physical_plan/parquet.rs
@@ -204,7 +204,34 @@ impl ParquetExec {
}
}
- /// Provide access to the statistics
+ /// Parquet partitions to read
+ pub fn partitions(&self) -> &[ParquetPartition] {
+ &self.partitions
+ }
+
+ /// Projection for which columns to load
+ pub fn projection(&self) -> &[usize] {
+ &self.projection
+ }
+
+ /// Batch size
+ pub fn batch_size(&self) -> usize {
+ self.batch_size
+ }
+
+ /// Statistics for the data set (sum of statistics for all partitions)
+ pub fn statistics(&self) -> &Statistics {
+ &self.statistics
+ }
+}
+
+impl ParquetPartition {
+ /// The Parquet filename for this partition
+ pub fn filenames(&self) -> &[String] {
+ &self.filenames
+ }
+
+ /// Statistics for this partition
pub fn statistics(&self) -> &Statistics {
&self.statistics
}
diff --git a/rust/datafusion/src/physical_plan/projection.rs b/rust/datafusion/src/physical_plan/projection.rs
index 2ef28c81f7..8ff5961645 100644
--- a/rust/datafusion/src/physical_plan/projection.rs
+++ b/rust/datafusion/src/physical_plan/projection.rs
@@ -75,6 +75,16 @@ impl ProjectionExec {
input: input.clone(),
})
}
+
+ /// The projection expressions stored as tuples of (expression, output column name)
+ pub fn expr(&self) -> &[(Arc<dyn PhysicalExpr>, String)] {
+ &self.expr
+ }
+
+ /// The input plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
}
#[async_trait]
diff --git a/rust/datafusion/src/physical_plan/repartition.rs b/rust/datafusion/src/physical_plan/repartition.rs
index 1ec1727f2a..3bcc7f0a6f 100644
--- a/rust/datafusion/src/physical_plan/repartition.rs
+++ b/rust/datafusion/src/physical_plan/repartition.rs
@@ -53,6 +53,18 @@ pub struct RepartitionExec {
channels: Arc<Mutex<Vec<(Sender<MaybeBatch>, Receiver<MaybeBatch>)>>>,
}
+impl RepartitionExec {
+ /// Input execution plan
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
+
+ /// Partitioning scheme to use
+ pub fn partitioning(&self) -> &Partitioning {
+ &self.partitioning
+ }
+}
+
#[async_trait]
impl ExecutionPlan for RepartitionExec {
/// Return a reference to Any that can be used for downcasting
diff --git a/rust/datafusion/src/physical_plan/sort.rs b/rust/datafusion/src/physical_plan/sort.rs
index 52c7aaa3a7..85655401c9 100644
--- a/rust/datafusion/src/physical_plan/sort.rs
+++ b/rust/datafusion/src/physical_plan/sort.rs
@@ -65,6 +65,16 @@ impl SortExec {
concurrency,
})
}
+
+ /// Input schema
+ pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
+ &self.input
+ }
+
+ /// Sort expressions
+ pub fn expr(&self) -> &[PhysicalSortExpr] {
+ &self.expr
+ }
}
#[async_trait]