-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include cost estimates in IO EXPLAIN plan #806
Include cost estimates in IO EXPLAIN plan #806
Conversation
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
While I already sent PR #709 (please ignore mine, I'll close it), why only estimated byte scanned? I think other information (e.g. outputRowCount) is also useful. Of course we can limit the field first. However, if you add estBytesScanned to TableColumnInfo directly, the output format will be like below.
While it's easy to parse, when we add fields later about estimated costs, it looks little redundant to me.
I hope you update presto-docs/src/main/sphinx/sql/explain.rst so that other developers can use this enhancement easily. |
@ebyhr apologies it hasn't been reviewed yet! @ebyhr @JamesRTaylor can you look at each other's PR and determine how much overlap is there? |
@findepi There's no need to apologize. Actually, I had completely forgot my PR until today and I hope @JamesRTaylor (the issue ticket author) implements this. Also, I'm little busy in this month. The main difference between my PR and this commit is I added a separated class and 5 metrics including estimated byte scanned. If there's no special reason to limit to the bytes, adding other 4 metrics looks good to me. @JamesRTaylor What do you think about it? |
Can you please rebase and get rid of merge commits (we do not use them). |
516394d
to
ea8a8aa
Compare
@kokosing - I rebased and squashed the commits. I looked at the test failure, but it doesn't appear related. |
@JamesRTaylor from Travis:
|
Oops, missed that - sorry about that. Was seeing other errors in the console that I thought was leading to the test failure. I'll get that fixed. |
All fixed now, @findepi. Sorry again for the noise. |
EstimatedStatsAndCost estimate16 = new EstimatedStatsAndCost(1.0, 16.0, 16.0, 0.0, 0.0, 6.0); | ||
EstimatedStatsAndCost estimate17 = new EstimatedStatsAndCost(1.0, 17.0, 17.0, 0.0, 0.0, 3.0); | ||
EstimatedStatsAndCost estimate25 = new EstimatedStatsAndCost(1.0, 25.0, 25.0, 0.0, 0.0, 3.0); | ||
Map<Object, TypeAndEstimate> data = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why linked hash map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a linked hash map because the assert below prints the index of the entry upon failure to make the entry easier to find.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add a comment about this, it is not obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use ImmutableMap.Builder
also when we want to preserve insertion order.
ImmutableMap guarantees order.
BTW here List<Entry<..>
would do. Or restructuring the test so that data
is not needed at all.
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
d73e657
to
ec78d26
Compare
@kokosing - thanks for the prior review. I've updated the PR based on your feedback:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also post how now EXPLAIN (TYPE IO)
looks now, and how it was before? So it is easy to compare how it changed.
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
EstimatedStatsAndCost estimate16 = new EstimatedStatsAndCost(1.0, 16.0, 16.0, 0.0, 0.0, 6.0); | ||
EstimatedStatsAndCost estimate17 = new EstimatedStatsAndCost(1.0, 17.0, 17.0, 0.0, 0.0, 3.0); | ||
EstimatedStatsAndCost estimate25 = new EstimatedStatsAndCost(1.0, 25.0, 25.0, 0.0, 0.0, 3.0); | ||
Map<Object, TypeAndEstimate> data = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add a comment about this, it is not obvious
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveTableStatistics.java
Outdated
Show resolved
Hide resolved
05d911c
to
ca9e68c
Compare
@kokosing - thanks for your previous reviews. I've pushed another commit based on your feedback. |
2ed895f
to
26c773d
Compare
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/planner/planprinter/IoPlanPrinter.java
Outdated
Show resolved
Hide resolved
Thanks for the feedback, @kokosing. I've pushed a new commit to address them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase and squash the commits. Then please extract formatting changes as separate commit before your actual change. Then I will merge this. Thanks!
new FormattedMarker(Optional.of("false"), EXACTLY), | ||
new FormattedMarker(Optional.of("false"), EXACTLY)))))))), | ||
Optional.of(new CatalogSchemaTableName(catalog, "tpch", "test_orders")))); | ||
ImmutableSet.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now when you change the formatting of existing code that is not strictly related to your change, please extract that as separate commit. Before your change.
sorry about such comments
7aff6a5
to
7b45f97
Compare
@kokosing - thanks for the reviews. I've pushed the changes. |
tableMetadata.getCatalogName().getCatalogName(), | ||
tableMetadata.getTable().getSchemaName(), | ||
tableMetadata.getTable().getTableName()), | ||
parseConstraints(node.getTable(), predicate))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ Thank you!
It looks there some issue with travis, some external service was unavailable. Restarted. |
Looks like an OOM error:
Please let me know if any action is required on my side. |
EstimatedStatsAndCost estimate16 = new EstimatedStatsAndCost(1.0, 16.0, 16.0, 0.0, 0.0, 6.0); | ||
EstimatedStatsAndCost estimate17 = new EstimatedStatsAndCost(1.0, 17.0, 17.0, 0.0, 0.0, 3.0); | ||
EstimatedStatsAndCost estimate25 = new EstimatedStatsAndCost(1.0, 25.0, 25.0, 0.0, 0.0, 3.0); | ||
Map<Object, TypeAndEstimate> data = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use ImmutableMap.Builder
also when we want to preserve insertion order.
ImmutableMap guarantees order.
BTW here List<Entry<..>
would do. Or restructuring the test so that data
is not needed at all.
estimate)), | ||
Optional.empty(), | ||
estimate), | ||
format("%d) Type %s ", index, type)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing (
?
So far we've been seeing OOM on full maven build (with verification), and rather rarely. @JamesRTaylor could you please trigger a new build (rather than retriggering the failed one) so that we can see how reproducible it is. You can also trigger a build with changed eg
@kokosing We can probably increase -Xmx for Maven, but need to think whether we don't go over limit somewhere else, when maven is running concurrently. |
It is strange to me as well. Let me retrigger the build with flushed cache. |
i see it green, so ... @JamesRTaylor @kokosing let's do nothing and wait until problem resurfaces. |
Merged, thanks! |
Implementation of #677