You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/08/24 11:44:00 UTC

[GitHub] [arrow] alamb commented on a change in pull request #8034: ARROW-9464: [Rust] [DataFusion] Physical plan optimization rule to insert MergeExec when needed

alamb commented on a change in pull request #8034:
URL: https://github.com/apache/arrow/pull/8034#discussion_r475537669



##########
File path: rust/datafusion/src/execution/physical_plan/mod.rs
##########
@@ -74,6 +85,15 @@ impl Partitioning {
     }
 }
 
+/// Distribution schemes
+#[derive(Debug, Clone)]
+pub enum Distribution {
+    /// Unspecified distribution

Review comment:
       I think "unspecified" is more accurate -- specifically the data is distributed around all the partitions, but the optimizer/planner doesn't know *how* it is distributed

##########
File path: rust/datafusion/src/execution/physical_plan/parquet.rs
##########
@@ -91,11 +91,26 @@ impl ExecutionPlan for ParquetExec {
         self.schema.clone()
     }
 
+    fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
+        // this is a leaf node and has no children
+        vec![]
+    }
+
     /// Get the output partitioning of this plan
     fn output_partitioning(&self) -> Partitioning {
         Partitioning::UnknownPartitioning(self.filenames.len())
     }
 
+    fn with_new_children(
+        &self,
+        _: Vec<Arc<dyn ExecutionPlan>>,
+    ) -> Result<Arc<dyn ExecutionPlan>> {
+        Err(ExecutionError::General(format!(

Review comment:
       This is fine for this PR, but I think this implementation could actually check that children was empty and then return `self.clone()`.

##########
File path: rust/datafusion/src/execution/physical_plan/mod.rs
##########
@@ -50,6 +50,17 @@ pub trait ExecutionPlan: Debug + Send + Sync {
     fn schema(&self) -> SchemaRef;
     /// Specifies the output partitioning scheme of this plan
     fn output_partitioning(&self) -> Partitioning;
+    /// Specifies the data distribution requirements of all the children for this operator
+    fn required_child_distribution(&self) -> Distribution {
+        Distribution::UnspecifiedDistribution
+    }
+    /// Get the children of this plan

Review comment:
       Or maybe
   
   ```
   /// `children` of this plan. This corresponds to all plans that provide input to this plan. 
   /// This function should return an empty vector for leaf nodes such as `scans`.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org