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 2021/05/13 20:26:31 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #337: Implement readable explain plans for physical plans

Dandandan commented on a change in pull request #337:
URL: https://github.com/apache/arrow-datafusion/pull/337#discussion_r632083020



##########
File path: datafusion/tests/sql.rs
##########
@@ -2885,3 +2885,45 @@ async fn test_cast_expressions_error() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_physical_plan_display_indent() {
+    let mut ctx = ExecutionContext::new();
+    register_aggregate_csv(&mut ctx).unwrap();
+    let sql = "SELECT c1, MAX(c12), MIN(c12) as the_min \
+         FROM aggregate_test_100 \
+         WHERE c12 < 10 \
+         GROUP BY c1 \
+         ORDER BY the_min DESC \
+         LIMIT 10";
+    let plan = ctx.create_logical_plan(&sql).unwrap();
+    let plan = ctx.optimize(&plan).unwrap();
+
+    let physical_plan = ctx.create_physical_plan(&plan).unwrap();
+    let expected = vec![
+        "GlobalLimitExec: limit=10",
+        "  SortExec: [the_min DESC]",
+        "    ProjectionExec: expr=[c1, MAX(c12), MIN(c12) as the_min]",
+        "      HashAggregateExec: mode=Final, gby=[c1], aggr=[MAX(c12), MIN(c12)]",
+        "        MergeExec",
+        "          HashAggregateExec: mode=Partial, gby=[c1], aggr=[MAX(c12), MIN(c12)]",
+        "            CoalesceBatchesExec: target_batch_size=4096",
+        "              FilterExec: c12 < CAST(10 AS Float64)",
+        "                RepartitionExec: partitioning=RoundRobinBatch(16)",

Review comment:
       Round robin repartition will move the batches as is one by 1 different partitions, in this case based on "round robin" so partion 1,2,3 etc. which are executed in different threads.
   There is also hash repartition which sends the values based on hashed keys to different threads.
   




-- 
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