Skip to content

Conversation

@Mariamalmesfer
Copy link
Contributor

@Mariamalmesfer Mariamalmesfer commented May 12, 2025

Cherry-pick of trinodb/trino#8584

Description

This PR adds support for the json type in the MongoDB connector.
It’s based on #17336, which no longer being worked on.

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

MongoDB Connector Changes
* Add support for Json type in MongoDB

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label May 12, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 12, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Mariamalmesfer / name: Mariam AlMesfer (bdae204)

@Mariamalmesfer Mariamalmesfer force-pushed the mongodb-json branch 4 times, most recently from e92c5c5 to afd29df Compare May 13, 2025 07:55
@Mariamalmesfer Mariamalmesfer force-pushed the mongodb-json branch 3 times, most recently from 34d06b9 to 19b069f Compare May 20, 2025 08:54
@Mariamalmesfer Mariamalmesfer marked this pull request as ready for review May 20, 2025 11:56
@Mariamalmesfer Mariamalmesfer requested a review from a team as a code owner May 20, 2025 11:56
@Mariamalmesfer Mariamalmesfer requested a review from ZacBlanco May 20, 2025 11:56
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and namya28 and removed request for a team May 20, 2025 11:56
@Mariamalmesfer Mariamalmesfer force-pushed the mongodb-json branch 3 times, most recently from bfc9e97 to c425186 Compare May 26, 2025 09:56
throws IOException
{
return Slices.wrappedBuffer(SORTED_MAPPER.writeValueAsBytes(value));
}
Copy link
Member

Choose a reason for hiding this comment

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

Unused method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

if (isJsonType(type)) {
String json = type.getSlice(block, position).toStringUtf8();
try {
return Document.parse(json);
Copy link
Member

Choose a reason for hiding this comment

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

Use static import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@agrawalreetika
Copy link
Member

Please add documentation entry as well in https://prestodb.io/docs/current/connector/mongodb.html

Cherry-pick of trinodb/trino#8584

Co-authored-by: Yuya Ebihara <ebyhry@gmail.com>
Co-authored-by: v-jizhang  <z_jinlin@yahoo.com>
@Mariamalmesfer
Copy link
Contributor Author

Please add documentation entry as well in https://prestodb.io/docs/current/connector/mongodb.html

@agrawalreetika I added a short section in the MongoDB docs explaining how json values are parsed. Not totally sure if that’s the right way—can you check it when you get a chance? @steveburnett is this the correct place for it?

@steveburnett
Copy link
Contributor

Please add documentation entry as well in https://prestodb.io/docs/current/connector/mongodb.html

@agrawalreetika I added a short section in the MongoDB docs explaining how json values are parsed. Not totally sure if that’s the right way—can you check it when you get a chance? @steveburnett is this the correct place for it?

LGTM! @agrawalreetika, does this doc satisfy your request?

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build, looks good. Thanks!

Copy link
Member

@agrawalreetika agrawalreetika left a comment

Choose a reason for hiding this comment

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

Thanks for the change. LGTM

@steveburnett steveburnett merged commit 6a455ac into prestodb:master May 27, 2025
98 checks passed
@ZacBlanco ZacBlanco mentioned this pull request May 29, 2025
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants