Skip to content
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

Serialize JSON directly from Pages #23975

Merged
merged 5 commits into from
Oct 31, 2024
Merged

Serialize JSON directly from Pages #23975

merged 5 commits into from
Oct 31, 2024

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Oct 30, 2024

This avoids:

  • going Page -> Iterable<List> -> JSON (instead we are now serializing Page values to JSON directly)
  • boxing/unboxing of primitive values (due to a Object Type.getObjectValue calls)
  • materializing byte[], String from *CharType and VarbinaryType
  • Description

    Additional context and related issues

    Release notes

    (x) This is not user-visible or is docs only, and no release notes are required.
    ( ) Release notes are required. Please propose a release note for me.
    ( ) Release notes are required, with the following suggested text:

    ## Section
    * Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Oct 30, 2024
@github-actions github-actions bot added the jdbc Relates to Trino JDBC driver label Oct 30, 2024
@wendigo wendigo force-pushed the serafin/json-encoders branch 5 times, most recently from eb9d704 to f49fc78 Compare October 30, 2024 15:03
@wendigo wendigo requested a review from losipiuk October 30, 2024 15:24
This avoids unnecessary boxing/unboxing for primitive values
which are boxed once the `Object getObjectValue` is called on a `Type`.

This now fetches primitive values directly and writes them to a JsonGenerator without unboxing.
Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine for what i can tell

This unifies serialization between the spooled and direct protocols
@wendigo wendigo merged commit b177f3a into master Oct 31, 2024
106 checks passed
@wendigo wendigo deleted the serafin/json-encoders branch October 31, 2024 05:49
@github-actions github-actions bot added this to the 465 milestone Oct 31, 2024
@@ -83,8 +83,8 @@ public ResultRows toRows(List<Column> columns, QueryData data)
}

verify(columns != null && !columns.isEmpty(), "Columns must be set when decoding data");
if (data instanceof RawQueryData) {
RawQueryData rawData = (RawQueryData) data;
if (data instanceof TypedQueryData) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we short circuit it?

if (data instanceof TypedQueryData rawData) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This is client so JDK 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed jdbc Relates to Trino JDBC driver
Development

Successfully merging this pull request may close these issues.

3 participants