Make EXPLAIN print local cost + Do not print Estimates line when estimates are absent#14268
Merged
sopel39 merged 2 commits intotrinodb:masterfrom Sep 28, 2022
Merged
Conversation
gaurav8297
approved these changes
Sep 23, 2022
efb0ffc to
16cda87
Compare
Member
Author
It's hard to add a test since in every query there is at least one I think we could skip it here |
Member
Author
|
fyi: @findepi |
16cda87 to
a73e713
Compare
core/trino-main/src/main/java/io/trino/sql/planner/planprinter/NodeRepresentation.java
Outdated
Show resolved
Hide resolved
raunaqmorarka
approved these changes
Sep 23, 2022
a73e713 to
d156bde
Compare
trinodb@e438e1e changed cost calculations to be cumulative. However, EXPLAIN still used PlanCostEstimate for showing plan node cost. This commit makes EXPLAIN use local cost. after (take a look at Aggregate operator cpu cost): trino> explain select count(orderkey) from hive.tpch_sf10_orc.lineitem; Query Plan --------------------------------------------------------------------------------------- Fragment 0 [SINGLE] Output layout: [count] Output partitioning: SINGLE [] Output[columnNames = [_col0]] │ Layout: [count:bigint] │ Estimates: {rows: 1 (9B), cpu: 0, memory: 0B, network: 0B} │ _col0 := count └─ Aggregate[] │ Layout: [count:bigint] │ Estimates: {rows: 1 (9B), cpu: 514.86M, memory: 9B, network: 0B} │ count := count("orderkey") └─ LocalExchange[partitioning = SINGLE] │ Layout: [orderkey:bigint] │ Estimates: {rows: 59986052 (514.86MB), cpu: 0, memory: 0B, network: 0B} └─ RemoteSource[sourceFragmentIds = [1]] Layout: [orderkey:bigint] Estimates: Fragment 1 [SOURCE] Output layout: [orderkey] Output partitioning: SINGLE [] TableScan[table = hive:tpch_sf10_orc:lineitem] Layout: [orderkey:bigint] Estimates: {rows: 59986052 (514.86MB), cpu: 514.86M, memory: 0B, network: 0B} orderkey := orderkey:bigint:REGULAR before: trino> explain select count(orderkey) from hive.tpch_sf10_orc.lineitem; Query Plan --------------------------------------------------------------------------------------------------- Fragment 0 [SINGLE] Output layout: [count] Output partitioning: SINGLE [] Output[columnNames = [_col0]] │ Layout: [count:bigint] │ Estimates: {rows: 1 (9B), cpu: 1.01G, memory: 9B, network: 514.86MB} │ _col0 := count └─ Aggregate[] │ Layout: [count:bigint] │ Estimates: {rows: 1 (9B), cpu: 1.01G, memory: 9B, network: 514.86MB} │ count := count("orderkey") └─ LocalExchange[partitioning = SINGLE] │ Layout: [orderkey:bigint] │ Estimates: {rows: 59986052 (514.86MB), cpu: 514.86M, memory: 0B, network: 514.86MB} └─ RemoteSource[sourceFragmentIds = [1]] Layout: [orderkey:bigint] Estimates: Fragment 1 [SOURCE] Output layout: [orderkey] Output partitioning: SINGLE [] TableScan[table = hive:tpch_sf10_orc:lineitem] Layout: [orderkey:bigint] Estimates: {rows: 59986052 (514.86MB), cpu: 514.86M, memory: 0B, network: 0B} orderkey := orderkey:bigint:REGULAR
Previously:
└─ Aggregate[type = PARTIAL, keys = [field], hash = [$hashvalue_3]]
│ Layout: [field:integer, $hashvalue_3:bigint, count_2:bigint]
│ Estimates:
│ count_2 := count("field_0") (mask = expr)
Now:
└─ Aggregate[type = PARTIAL, keys = [field], hash = [$hashvalue_3]]
│ Layout: [field:integer, $hashvalue_3:bigint, count_2:bigint]
│ count_2 := count("field_0") (mask = expr)
d156bde to
59a645d
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.