-
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
Implement faster JSON decoder compatible with original one #23352
base: master
Are you sure you want to change the base?
Conversation
230e206
to
90aaf26
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.
Can you add a test that has some literal JSON, so that it's easy to see what the JSON looks like?
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataAccess.java
Outdated
Show resolved
Hide resolved
a2755c9
to
1b5c6fb
Compare
1b5c6fb
to
2ec10bd
Compare
This is a preparation step to change the way spooled JSON is produced and than decoded.
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.
Looks good overall
client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataAccess.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataAccess.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Outdated
Show resolved
Hide resolved
2ec10bd
to
0ffe368
Compare
client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java
Outdated
Show resolved
Hide resolved
Benchmarks: fetching and decoding 4M rows over spooled protocol locally. Before:
After:
In comparison non-spooled protocol runs in ~30s |
0ffe368
to
38b7e93
Compare
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataAccess.java
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/EncodedQueryData.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonDecodingUtils.java
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataAccess.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/server/protocol/spooling/TestJsonQueryDataEncoding.java
Show resolved
Hide resolved
...n/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java
Show resolved
Hide resolved
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 % comment about iterable
Current JSON decoding logic requires two passes to decode JSON values: - reading List<Object> using ObjectMapper - applying type information on top of the primitive JSON values Instead, the new decoder does the reading of the primitive JSON values and type application in a single pass that is both faster and reduces the amount of memory allocation which results in 30% improvement in the spooled protocol.
According to a Jackson's performance guidelines, parsing from byte[] is faster than parsing from InputStream.
38b7e93
to
b61fa07
Compare
No description provided.