-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Dont use row block field block offsets if not needed #10825
Dont use row block field block offsets if not needed #10825
Conversation
c3fff75
to
4b07829
Compare
Is it really a draft? If you think it's ready make it non-draft? |
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/block/BenchmarkRowBlock.java
Outdated
Show resolved
Hide resolved
mind automation (maven checks) |
c3a8f3c
to
45904d9
Compare
130c1bd
to
27e0015
Compare
core/trino-spi/src/main/java/io/trino/spi/block/AbstractRowBlock.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
EncoderUtil.encodeNullsAsBits(sliceOutput, block); | ||
|
||
if (isNullPresent && fieldBlockOffsets != null) { | ||
int[] positions = IntStream.range(0, positionCount + 1).map(i -> fieldBlockOffsets[offsetBase + i] - startFieldBlockOffset).toArray(); |
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.
streams are not good in tight loops. You can use io.airlift.slice.Slices#wrappedIntArray(int[], int, int)
to point at specific offset without copying data
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
ab279c6
to
f48db07
Compare
8d269bb
to
a163612
Compare
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerWithSplits.java
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
import static org.testng.Assert.assertNotNull; | ||
import static org.testng.Assert.assertNull; | ||
|
||
public class TestFromFieldBlocksCreatorForRowBlock |
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.
rename it back to testRowBlock
c4cd596
to
3fdc374
Compare
4175e77
to
245c8d5
Compare
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.
Added some comments, will look again tomoroow
245c8d5
to
afd150a
Compare
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.
LGTM % comments
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkDataGenerator.java
Show resolved
Hide resolved
afd150a
to
d0ed9a0
Compare
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.
lgtm % comments
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/RowBlockEncoding.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/test/java/io/trino/spi/block/TestRowBlock.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/test/java/io/trino/spi/block/TestRowBlock.java
Outdated
Show resolved
Hide resolved
d0ed9a0
to
2a2a3d5
Compare
When there are no null rows within RowBlock then it's not needed to store fieldBlockOffsets. This improves performance and reduces network traffic as fieldBlockOffsets array is not serialized or deserialized. Tests TestRowBlock and TestRowBlockEncoding were added. Benchmark result: Benchmark (before/after) (nullChance) Mode Cnt Score Error Units (before) BenchmarkBlockSerde.deserializeRow 0 avgt 60 17.348 ± 0.109 ns/op (after) BenchmarkBlockSerde.deserializeRow 0 avgt 60 15.205 ± 0.084 ns/op (before) BenchmarkBlockSerde.deserializeRow .01 avgt 60 18.020 ± 0.104 ns/op (after) BenchmarkBlockSerde.deserializeRow .01 avgt 60 18.279 ± 0.113 ns/op (before) BenchmarkBlockSerde.deserializeRow .10 avgt 60 16.859 ± 0.140 ns/op (after) BenchmarkBlockSerde.deserializeRow .10 avgt 60 16.494 ± 0.157 ns/op (before) BenchmarkBlockSerde.deserializeRow .50 avgt 60 10.273 ± 0.044 ns/op (after) BenchmarkBlockSerde.deserializeRow .50 avgt 60 10.491 ± 0.063 ns/op (before) BenchmarkBlockSerde.deserializeRow .90 avgt 60 4.351 ± 0.020 ns/op (after) BenchmarkBlockSerde.deserializeRow .90 avgt 60 4.311 ± 0.013 ns/op (before) BenchmarkBlockSerde.deserializeRow .99 avgt 60 2.919 ± 0.027 ns/op (after) BenchmarkBlockSerde.deserializeRow .99 avgt 60 2.851 ± 0.008 ns/op (before) BenchmarkBlockSerde.serializeRow 0 avgt 60 20.862 ± 0.117 ns/op (after) BenchmarkBlockSerde.serializeRow 0 avgt 60 16.941 ± 0.089 ns/op (before) BenchmarkBlockSerde.serializeRow .01 avgt 60 21.588 ± 0.097 ns/op (after) BenchmarkBlockSerde.serializeRow .01 avgt 60 20.045 ± 0.102 ns/op (before) BenchmarkBlockSerde.serializeRow .10 avgt 60 20.667 ± 0.068 ns/op (after) BenchmarkBlockSerde.serializeRow .10 avgt 60 19.448 ± 0.126 ns/op (before) BenchmarkBlockSerde.serializeRow .50 avgt 60 13.217 ± 0.090 ns/op (after) BenchmarkBlockSerde.serializeRow .50 avgt 60 11.839 ± 0.042 ns/op (before) BenchmarkBlockSerde.serializeRow .90 avgt 60 7.404 ± 0.017 ns/op (after) BenchmarkBlockSerde.serializeRow .90 avgt 60 5.615 ± 0.009 ns/op (before) BenchmarkBlockSerde.serializeRow .99 avgt 60 5.517 ± 0.007 ns/op (after) BenchmarkBlockSerde.serializeRow .99 avgt 60 3.534 ± 0.009 ns/op
2a2a3d5
to
f1459b2
Compare
core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkDataGenerator.java
Show resolved
Hide resolved
small comment |
Too small, specific change for RN. |
This improves performance and reduces network traffic as fieldBlockOffsets array is not serialized or deserialized.