Improvements to Unnest Operator#10506
Conversation
bae88bd to
cca916a
Compare
|
one of the failures was unrelated #10038 |
|
@phd3 I'm a little overbooked right now and likely wont be able to take a look this week. I can try to find some time next week if not reviewed / merged by then. |
losipiuk
left a comment
There was a problem hiding this comment.
LGTM. Naming mostly and some questions.
Is the implementation already proofed on prestodb?
core/trino-spi/src/main/java/io/trino/spi/block/SingleMapBlock.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/unnest/Unnester.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/unnest/TestUnnestOperator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/unnest/TestUnnestOperator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/unnest/TestUnnestOperator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/unnest/TestUnnestOperator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/operator/unnest/TestingUnnesterUtil.java
Outdated
Show resolved
Hide resolved
|
flaky #12875 |
core/trino-main/src/main/java/io/trino/operator/GroupByIdBlock.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/BlockBuilder.java
Outdated
Show resolved
Hide resolved
losipiuk
left a comment
There was a problem hiding this comment.
Thanks. Looks good.
On the second look it feels like naming could still be a bit nicer. But if it is pain to address I am fine with names from the PR too.
As for the benchmark, are we sure that the refactor in the last commit does not introduce behaviour change (i.e. are we sure improved performance is strictly due to production changes, not benchmark code changes)? Did you try to run benchmark with new production code, but old benchmark class without refactorings?
And please address the conflict.
core/trino-main/src/main/java/io/trino/operator/unnest/UnnestOperator.java
Show resolved
Hide resolved
Benchmark (nullsRatio) Mode Cnt Score Error Units BenchmarkCopyBlock.copyBlockByAppend 0 avgt 30 4941.237 ± 1221.599 us/op BenchmarkCopyBlock.copyBlockByAppend 0.2 avgt 30 4583.895 ± 268.919 us/op BenchmarkCopyBlock.copyBlockByLoop 0 avgt 30 1421.283 ± 164.73 us/op BenchmarkCopyBlock.copyBlockByLoop 0.2 avgt 30 1850.813 ± 263.724 us/op Comparable changes from prestodb/presto#13746 Co-authored-by: Ying Su <yingsu@fb.com>
Comparable changes from prestodb/presto#13746 Co-authored-by: Ying Su <yingsu@fb.com>
Comparable changes from prestodb/presto#13746 replicate,unnest unnest null % Implementation us/op varchar,array(varchar), 0 old 12112.09 ± 925.452 us/op varchar,array(varchar), 0 new 2584.86 ± 242.155 us/op varchar,array(varchar), 0.05 old 11609.358 ± 869.656 us/op varchar,array(varchar), 0.05 new 2278.788 ± 109.432 us/op varchar,map(varchar,varchar), 0 old 14539.333 ± 730.733 us/op varchar,map(varchar,varchar), 0 new 2368.276 ± 87.712 us/op varchar,map(varchar,varchar), 0.05 old 13898.414 ± 118.539 us/op varchar,map(varchar,varchar), 0.05 new 2289.834 ± 41.853 us/op varchar,array(row(varchar,varchar,varchar)), 0 old 27944.668 ± 1292.521 us/op varchar,array(row(varchar,varchar,varchar)), 0 new 2643.749 ± 214.019 us/op varchar,array(row(varchar,varchar,varchar)), 0.05 old 28443.996 ± 1846.325 us/op varchar,array(row(varchar,varchar,varchar)), 0.05 new 14353.898 ± 1038.962 us/op varchar,array(array(varchar)), 0 old 12334.193 ± 916.8 us/op varchar,array(array(varchar)), 0 new 2452.163 ± 138.614 us/op varchar,array(array(varchar)), 0.05 old 11037.719 ± 1353.202 us/op varchar,array(array(varchar)), 0.05 new 3037.677 ± 1288.91 us/op varchar,array(varchar)|array(varchar), 0 old 223204.589 ± 53170.945 us/op varchar,array(varchar)|array(varchar), 0 new 11602.298 ± 1359.086 us/op varchar,array(varchar)|array(varchar), 0.05 old 21610.119 ± 1298.055 us/op varchar,array(varchar)|array(varchar), 0.05 new 7475.767 ± 507.788 us/op Co-authored-by: Ying Su <yingsu@fb.com>
* Reuse block generation code from BlockAssertions * Use one null ratio value as row nulls ratio isn't super useful in the benchmark matrix. * Make unnest type inputs more generic. Comparable changes from prestodb/presto#13746 Co-authored-by: Ying Su <yingsu@fb.com>
I had tried that early on. Ran them again to make sure. The results are pretty similar. https://gist.github.com/phd3/b5c877aa28cbccbbcb232cbd69cc4b57. There's some issue with morethan displaying them side by side using gists. But here's the screenshot. AC. |
Thank @phd3 . good to be merged IMO. |
Description
Improve performance of Unnest operator. Comparable changes from prestodb/presto#13751 with some bugfixes.
Benchmark on jmh.morethan.io
Documentation
(x) No documentation is needed.
Release notes
(x) Release notes entries required with the following suggested text: