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/09/14 19:14:05 UTC

[GitHub] [arrow-datafusion] alamb opened a new pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

alamb opened a new pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004


   # Which issue does this PR close?
   
   Next part https://github.com/apache/arrow-datafusion/issues/866 (following the same model as https://github.com/apache/arrow-datafusion/pull/960).
   
   
    # Rationale for this change
   We want basic understanding of where a plan's time is spent and in what operators. See https://github.com/apache/arrow-datafusion/issues/866 for more details
   
   # What changes are included in this PR?
   1. Instrument `ProjectionExec`, `GlobalLimitExec`, `LocalLimitExec` and `CoalesceBatchesExec` using the API from https://github.com/apache/arrow-datafusion/pull/909
   2. Tests for same
   
   
   # Are there any user-facing changes?
   More fields in `EXPLAIN ANALYZE` are now filled out
   
   Example of how explain analyze is looking (dense but packed with good info)
   
   ```sql
   running query: EXPLAIN ANALYZE select count(*) from (SELECT count(*), c1 FROM aggregate_test_100 WHERE c13 != 'C2GT5KVyOPZpgKVl110TyZO0NcJ434' GROUP BY c1 ORDER BY c1) LIMIT 1
   Query Output:
   
   +-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type         | plan                                                                                                                                                                                                                                |
   +-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Plan with Metrics | GlobalLimitExec: limit=1, metrics=[output_rows=1, elapsed_compute=182ns]                                                                                                                                                            |
   |                   |   ProjectionExec: expr=[COUNT(UInt8(1))@0 as COUNT(UInt8(1))], metrics=[output_rows=1, elapsed_compute=7.556µs]                                                                                                                     |
   |                   |     HashAggregateExec: mode=Final, gby=[], aggr=[COUNT(UInt8(1))], metrics=[output_rows=1, elapsed_compute=48.283µs]                                                                                                                |
   |                   |       CoalescePartitionsExec, metrics=[output_rows=3, elapsed_compute=NOT RECORDED]                                                                                                                                                 |
   |                   |         HashAggregateExec: mode=Partial, gby=[], aggr=[COUNT(UInt8(1))], metrics=[output_rows=3, elapsed_compute=101.291µs]                                                                                                         |
   |                   |           RepartitionExec: partitioning=RoundRobinBatch(3), metrics=[fetch_time{inputPartition=0}=10.721068ms, send_time{inputPartition=0}=3.93µs, repart_time{inputPartition=0}=NOT RECORDED]                                      |
   |                   |             SortExec: [c1@0 ASC], metrics=[output_rows=5, elapsed_compute=184.753µs]                                                                                                                                                |
   |                   |               CoalescePartitionsExec, metrics=[output_rows=5, elapsed_compute=NOT RECORDED]                                                                                                                                         |
   |                   |                 HashAggregateExec: mode=FinalPartitioned, gby=[c1@0 as c1], aggr=[COUNT(UInt8(1))], metrics=[output_rows=5, elapsed_compute=299.555µs]                                                                              |
   |                   |                   CoalesceBatchesExec: target_batch_size=4096, metrics=[output_rows=5, elapsed_compute=73.812µs]                                                                                                                    |
   |                   |                     RepartitionExec: partitioning=Hash([Column { name: "c1", index: 0 }], 3), metrics=[send_time{inputPartition=0}=NOT RECORDED, fetch_time{inputPartition=0}=28.696948ms, repart_time{inputPartition=0}=201.886µs] |
   |                   |                       HashAggregateExec: mode=Partial, gby=[c1@0 as c1], aggr=[COUNT(UInt8(1))], metrics=[output_rows=5, elapsed_compute=560.718µs]                                                                                 |
   |                   |                         CoalesceBatchesExec: target_batch_size=4096, metrics=[output_rows=99, elapsed_compute=306.864µs]                                                                                                            |
   |                   |                           FilterExec: c13@1 != C2GT5KVyOPZpgKVl110TyZO0NcJ434, metrics=[output_rows=99, elapsed_compute=264.367µs]                                                                                                  |
   |                   |                             RepartitionExec: partitioning=RoundRobinBatch(3), metrics=[repart_time{inputPartition=0}=NOT RECORDED, send_time{inputPartition=0}=5.482µs, fetch_time{inputPartition=0}=6.933244ms]                    |
   |                   |                               CsvExec: source=Path(/Users/alamb/Software/arrow/testing/data/csv/aggregate_test_100.csv: [/Users/alamb/Software/arrow/testing/data/csv/aggregate_test_100.csv]), has_header=true, metrics=[]         |
   +-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   
   
   ```
   


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] Dandandan commented on pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

Posted by GitBox <gi...@apache.org>.
Dandandan commented on pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004#issuecomment-919636634


   Amazing 😎


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] alamb commented on pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004#issuecomment-919500668


   BTW here are some cool screen shots of using this data in IOx to visualize DataFusion execution plan progression: https://github.com/influxdata/influxdb_iox/pull/2529 if anyone is interested
   
   ![Screen Shot 2021-09-13 at 12 05 54 PM](https://user-images.githubusercontent.com/490673/133331398-3030a14b-3019-4dde-b724-6812a49a6b82.png)
   
   ![Screen Shot 2021-09-13 at 12 07 52 PM](https://user-images.githubusercontent.com/490673/133331416-591ede8e-c774-45cc-90ec-4e0f18ceb264.png)
   


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] Dandandan merged pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

Posted by GitBox <gi...@apache.org>.
Dandandan merged pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004


   


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] houqp commented on pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004#issuecomment-919692265


   really cool jaeger indeed!


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1004: Add metrics for Limit and Projection, and CoalesceBatches

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1004:
URL: https://github.com/apache/arrow-datafusion/pull/1004#discussion_r708607135



##########
File path: datafusion/tests/sql.rs
##########
@@ -2395,14 +2397,33 @@ async fn explain_analyze_baseline_metrics() {
         "FilterExec: c13@1 != C2GT5KVyOPZpgKVl110TyZO0NcJ434",
         "metrics=[output_rows=99, elapsed_compute="
     );
+    assert_metrics!(
+        &formatted,
+        "GlobalLimitExec: limit=1, ",
+        "metrics=[output_rows=1, elapsed_compute="
+    );
+    assert_metrics!(
+        &formatted,
+        "ProjectionExec: expr=[COUNT(UInt8(1))",
+        "metrics=[output_rows=1, elapsed_compute="
+    );
+    assert_metrics!(
+        &formatted,
+        "CoalesceBatchesExec: target_batch_size=4096",
+        "metrics=[output_rows=5, elapsed_compute"
+    );
 
     fn expected_to_have_metrics(plan: &dyn ExecutionPlan) -> bool {
-        use datafusion::physical_plan::{
-            hash_aggregate::HashAggregateExec, sort::SortExec,
-        };
-
-        plan.as_any().downcast_ref::<SortExec>().is_some()
-            || plan.as_any().downcast_ref::<HashAggregateExec>().is_some()
+        use datafusion::physical_plan;
+
+        plan.as_any().downcast_ref::<physical_plan::sort::SortExec>().is_some()
+            || plan.as_any().downcast_ref::<physical_plan::hash_aggregate::HashAggregateExec>().is_some()
+            // CoalescePartitionsExec doesn't do any work so is not included
+            || plan.as_any().downcast_ref::<physical_plan::hash_aggregate::HashAggregateExec>().is_some()

Review comment:
       This line seems duplicated




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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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