prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.06k stars 5.38k forks source link

Presto UI Stage Performance does not show operators which refer to plan nodes created by workers #24054

Open LeonidChistov opened 4 days ago

LeonidChistov commented 4 days ago

Presto UI Stage Performance tab does not show operators which refer to plan nodes which were created on worker side during plan rewriting and are not present in original plan.

Example of code that does plan rewrite on worker side: https://github.com/prestodb/presto/blob/360bf94c7bccb4c9a24517676234dd54f7681baf/presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp#L423

Here the new plan node is created.

Your Environment

Expected Behavior

All operators present in latestAttemptExecutionInfo.stats.operatorSummaries section need to be visible in UI to allow performance analysis.

Current Behavior

Only operators that have planNodeId set to id of plan node present in the original query plan are shown in Stage Performance tab.

It can be seen that this is due to Presto UI implementation that considers for rendering only operators with plan nodes ids from the original plan:

https://github.com/prestodb/presto/blob/e51c7939ed8f6e8f6b16fcf01f1e6d70a455ae92/presto-ui/src/components/QueryStageView.jsx#L364

Possible Solution

Simplest solution would be to change Presto UI logic to use only operatorSummaries section for pipelines rendering and avoid referring to query pan.

In this case operator ids will be used to determine order of operators in the pipeline.

It is not clear though, why this approach was not initially implemented and whether this change may break anything,

Steps to Reproduce

Problem was reproduced when running TPCH Q1 with Hive connector.

Relevant fragment of execution JSON dump: https://pastebin.com/J9vZjGmk

Here FilterProject operator with plan node id 442.0 is present:

 {
          "stageId" : 0,
          "stageExecutionId" : 0,
          "pipelineId" : 1,
          "operatorId" : 1,
          "planNodeId" : "442.0",
          "operatorType" : "FilterProject",
...

while in the original plan there is only a node with id 442:

       "source" : {
            "@type" : "com.facebook.presto.sql.planner.plan.ExchangeNode",
            "sourceLocation" : {
              "line" : 19,
              "column" : 1
            },
            "id" : "442",
            "type" : "GATHER",
            "scope" : "LOCAL",

Screenshots (if appropriate)

Screenshot from 2024-11-15 13-43-59

yhwang commented 4 days ago

@LeonidChistov the existing UI logic is to display the plan tree as a DAG graph. As you mentioned, showing the operators that are not in the original plan would help the analysis. I suggest you try to add those operator nodes to the graph and see what it looks like. I don't think it would break anything. FYI, the existing code does parse the whole list of the operatorSummaries here.