Skip to content

Commit

Permalink
Add getters to ExecutionPlan Properties (#13409)
Browse files Browse the repository at this point in the history
* Expose Execution Plan Properties

* Expose Execution Plan Properties

* Expose Execution Plan Properties

* Expose Execution Plan Properties

* Expose Execution Plan Properties
  • Loading branch information
shehabgamin authored Nov 14, 2024
1 parent de450d4 commit 57235c2
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datafusion/core/src/datasource/physical_plan/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ impl NdJsonExec {
&self.base_config
}

/// Ref to file compression type
pub fn file_compression_type(&self) -> &FileCompressionType {
&self.file_compression_type
}

fn output_partitioning_helper(file_scan_config: &FileScanConfig) -> Partitioning {
Partitioning::UnknownPartitioning(file_scan_config.file_groups.len())
}
Expand Down
18 changes: 18 additions & 0 deletions datafusion/physical-plan/src/joins/sort_merge_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,36 @@ impl SortMergeJoinExec {
&self.on
}

/// Ref to right execution plan
pub fn right(&self) -> &Arc<dyn ExecutionPlan> {
&self.right
}

/// Join type
pub fn join_type(&self) -> JoinType {
self.join_type
}

/// Ref to left execution plan
pub fn left(&self) -> &Arc<dyn ExecutionPlan> {
&self.left
}

/// Ref to join filter
pub fn filter(&self) -> &Option<JoinFilter> {
&self.filter
}

/// Ref to sort options
pub fn sort_options(&self) -> &[SortOptions] {
&self.sort_options
}

/// Null equals null
pub fn null_equals_null(&self) -> bool {
self.null_equals_null
}

/// This function creates the cache object that stores the plan properties such as schema, equivalence properties, ordering, partitioning, etc.
fn compute_properties(
left: &Arc<dyn ExecutionPlan>,
Expand Down
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,26 @@ impl MemoryExec {
self
}

/// Ref to partitions
pub fn partitions(&self) -> &[Vec<RecordBatch>] {
&self.partitions
}

/// Ref to projection
pub fn projection(&self) -> &Option<Vec<usize>> {
&self.projection
}

/// Show sizes
pub fn show_sizes(&self) -> bool {
self.show_sizes
}

/// Ref to sort information
pub fn sort_information(&self) -> &[LexOrdering] {
&self.sort_information
}

/// A memory table can be ordered by multiple expressions simultaneously.
/// [`EquivalenceProperties`] keeps track of expressions that describe the
/// global ordering of the schema. These columns are not necessarily same; e.g.
Expand Down Expand Up @@ -261,6 +273,7 @@ impl MemoryExec {
Ok(self)
}

/// Arc clone of ref to original schema
pub fn original_schema(&self) -> SchemaRef {
Arc::clone(&self.schema)
}
Expand Down
20 changes: 20 additions & 0 deletions datafusion/physical-plan/src/recursive_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@ impl RecursiveQueryExec {
})
}

/// Ref to name
pub fn name(&self) -> &str {
&self.name
}

/// Ref to static term
pub fn static_term(&self) -> &Arc<dyn ExecutionPlan> {
&self.static_term
}

/// Ref to recursive term
pub fn recursive_term(&self) -> &Arc<dyn ExecutionPlan> {
&self.recursive_term
}

/// is distinct
pub fn is_distinct(&self) -> bool {
self.is_distinct
}

/// This function creates the cache object that stores the plan properties such as schema, equivalence properties, ordering, partitioning, etc.
fn compute_properties(schema: SchemaRef) -> PlanProperties {
let eq_properties = EquivalenceProperties::new(schema);
Expand Down
5 changes: 5 additions & 0 deletions datafusion/physical-plan/src/sorts/partial_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ impl PartialSortExec {
self.fetch
}

/// Common prefix length
pub fn common_prefix_length(&self) -> usize {
self.common_prefix_length
}

fn output_partitioning_helper(
input: &Arc<dyn ExecutionPlan>,
preserve_partitioning: bool,
Expand Down
10 changes: 10 additions & 0 deletions datafusion/physical-plan/src/work_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ impl WorkTableExec {
}
}

/// Ref to name
pub fn name(&self) -> &str {
&self.name
}

/// Arc clone of ref to schema
pub fn schema(&self) -> SchemaRef {
Arc::clone(&self.schema)
}

pub(super) fn with_work_table(&self, work_table: Arc<WorkTable>) -> Self {
Self {
name: self.name.clone(),
Expand Down

0 comments on commit 57235c2

Please sign in to comment.