Skip to content

Write mapping support #25124

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Write mapping support #25124

wants to merge 1 commit into from

Conversation

infvg
Copy link
Contributor

@infvg infvg commented May 15, 2025

Description

Currently, write mapping is hard coded in JdbcPageSink.appendColumn, making it difficult to add additional write support. This PR adds WriteMapping to match the ReadMapping functionality & make it possible to add additional type support on a per connector basis.

Motivation and Context

It will allow us to support additional types on a per connector basis

Impact

None

Test Plan

Unit tests

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

== RELEASE NOTES ==

JDBC Driver Changes
* Improve type mapping API to add WriteMapping functionality.

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label May 15, 2025
@infvg infvg marked this pull request as ready for review May 15, 2025 16:38
@infvg infvg requested a review from a team as a code owner May 15, 2025 16:38
@infvg infvg requested a review from ZacBlanco May 15, 2025 16:38
@prestodb-ci prestodb-ci requested review from a team, bibith4 and NivinCS and removed request for a team May 15, 2025 16:38
@infvg infvg force-pushed the write-mapping branch 4 times, most recently from 50a7742 to e7b8684 Compare May 15, 2025 17:13
@infvg infvg requested a review from pratyakshsharma May 15, 2025 17:13
@infvg infvg force-pushed the write-mapping branch 8 times, most recently from b03db2f to de13a86 Compare May 20, 2025 09:16
@infvg infvg changed the title [DNR] Write mapping support Write mapping support May 20, 2025
Copy link
Contributor

@ZacBlanco ZacBlanco left a comment

Choose a reason for hiding this comment

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

A few initial comments

.gitignore Outdated
@@ -18,6 +18,7 @@ test-reports/
.DS_Store
.classpath
.settings
.java-version
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional?

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

else if (type.getTypeSignature().getBase().equals(StandardTypes.JSON)) {
return sliceMapping("jsonb", ((statement, index, value) -> {
PGobject pgObject = new PGobject();
pgObject.setType("json");
pgObject.setValue(value.toStringUtf8());
statement.setObject(index, pgObject);
}));
}
return super.toWriteMapping(type);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we're also adding support for JSON types here? If so, can the JSON support be in a separate commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have another PR that will add additional type supports so I'll move it to there

}

return super.toSqlType(type);
else if (type.getTypeSignature().getBase().equals(StandardTypes.JSON)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
else if (type.getTypeSignature().getBase().equals(StandardTypes.JSON)) {
else if (type.getTypeSignature().getBase().equals(JSON)) {


return super.toSqlType(type);
else if (type.getTypeSignature().getBase().equals(StandardTypes.JSON)) {
return sliceMapping("jsonb", ((statement, index, value) -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this jsonb? Are we able to convert to the binary form for postgres? I think it should be json

Copy link
Contributor

Choose a reason for hiding this comment

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

This also needs tests

@infvg infvg force-pushed the write-mapping branch 2 times, most recently from c065212 to 84ded12 Compare May 22, 2025 08:31
Copy link

github-actions bot commented May 22, 2025

Codenotify: Notifying subscribers in CODENOTIFY files for diff 57a85ce...5f8e951.

No notifications.

Co-authored-by: pratyakshsharma <[email protected]>
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.

3 participants