Skip to content

Comments

Add comma for number in printed query plan#21486

Merged
feilong-liu merged 1 commit intoprestodb:masterfrom
feilong-liu:plan_number_comma
Dec 7, 2023
Merged

Add comma for number in printed query plan#21486
feilong-liu merged 1 commit intoprestodb:masterfrom
feilong-liu:plan_number_comma

Conversation

@feilong-liu
Copy link
Contributor

@feilong-liu feilong-liu commented Dec 5, 2023

Description

In the printed plan, add comma in the number so that it's more readable, for example
from rows: 15000 (1.86MB), cpu: 1948552.00, memory: 0.00, network: 1948552.00 to rows: 15,000 (1.86MB), cpu: 1,948,552.00, memory: 0.00, network: 1,948,552.00

Motivation and Context

To debug a query, we often need to compare the output for each operator, however the current format is hard to read for big numbers. This will make it more readable.

Impact

Make the printed query plan more readable.

Test Plan

Run query end to end to verify the new format is expected.

presto:tpch> explain select * from orders;
                                                                                                                                                                                                 Qu>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
 - Output[PlanNodeId 5][orderkey, custkey, orderstatus, totalprice, orderdate, orderpriority, clerk, shippriority, comment] => [orderkey:bigint, custkey:bigint, orderstatus:varchar(1), totalprice>
         Estimates: {source: CostBasedSourceInfo, rows: 15,000 (1.86MB), cpu: 1,948,552.00, memory: 0.00, network: 1,948,552.00}                                                                   >
     - RemoteStreamingExchange[PlanNodeId 95][GATHER] => [orderkey:bigint, custkey:bigint, orderstatus:varchar(1), totalprice:double, orderdate:date, orderpriority:varchar(15), clerk:varchar(15),>
             Estimates: {source: CostBasedSourceInfo, rows: 15,000 (1.86MB), cpu: 1,948,552.00, memory: 0.00, network: 1,948,552.00}                                                               >
         - TableScan[PlanNodeId 0][TableHandle {connectorId='hive', connectorHandle='HiveTableHandle{schemaName=tpch, tableName=orders, analyzePartitionValues=Optional.empty}', layout='Optional[t>
                 Estimates: {source: CostBasedSourceInfo, rows: 15,000 (1.86MB), cpu: 1,948,552.00, memory: 0.00, network: 0.00}                                                                   >
                 LAYOUT: tpch.orders{}                                                                                                                                                             >
                 orderpriority := orderpriority:varchar(15):5:REGULAR (1:23)                                                                                                                       >
                 orderstatus := orderstatus:varchar(1):2:REGULAR (1:23)                                                                                                                            >
                 orderdate := orderdate:date:4:REGULAR (1:23)                                                                                                                                      >
                 custkey := custkey:bigint:1:REGULAR (1:23)                                                                                                                                        >
                 comment := comment:varchar(79):8:REGULAR (1:23)                                                                                                                                   >
                 shippriority := shippriority:int:7:REGULAR (1:23)                                                                                                                                 >
                 clerk := clerk:varchar(15):6:REGULAR (1:23)                                                                                                                                       >
                 orderkey := orderkey:bigint:0:REGULAR (1:23)                                                                                                                                      >
                 totalprice := totalprice:double:3:REGULAR (1:23)                                                                                                                                  >
                                                                                                                                                                                                   >
(1 row)

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Improve the readability of query plan by making the number printed in query plan to be comma separated.

@aaneja
Copy link
Contributor

aaneja commented Dec 6, 2023

While we're on this subject, can we make a change to NOT have the PlanNodeId's outputed with a , ?
E.g I see FilterProject[PlanNodeId 474,273] printed, and for IDs like this one, just 474273 is easier to read / trace IMO

@feilong-liu
Copy link
Contributor Author

PlanNodeId

FilterProject[PlanNodeId 474,273] means this operator is from two plan nodes, filter and project, whose plan node id is 474 and 273 respectively. Not one single node id with 474273. It's unrelated to the change here.

@aaneja
Copy link
Contributor

aaneja commented Dec 7, 2023

PlanNodeId

FilterProject[PlanNodeId 474,273] means this operator is from two plan nodes, filter and project, whose plan node id is 474 and 273 respectively. Not one single node id with 474273.

My bad, this wasn't obvious to me!

Copy link
Contributor

@ajaygeorge ajaygeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@feilong-liu feilong-liu merged commit 3d4db80 into prestodb:master Dec 7, 2023
@feilong-liu feilong-liu deleted the plan_number_comma branch December 7, 2023 18:36
@wanglinsong wanglinsong mentioned this pull request Feb 12, 2024
64 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants