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

Use MillisInstant by default when Python JdbcIO is used #29182

Closed
wants to merge 1 commit into from

Conversation

Abacn
Copy link
Contributor

@Abacn Abacn commented Oct 28, 2023

Resolve https://stackoverflow.com/questions/77317904/apache-beam-python-sdk-reading-from-postgres-using-jdbc-io

Some context:

This has been a long-standing issue. MillisInstant is a logical type that backs Java's DATETIME type in schema (in Java side, its language type is a Joda Instant). In Beam portable framework, DATETIME is no longer a primitive type (true for Python, Go but not for Java), but rather a logical type backed by a MicrosInstant. Its language type is a Java.time.Instant (due to joda is in maintenance mode and there is plan to replace to java.time.Instant.

This would be a breaking change and milestoned at next major version). As such, Java SDK still uses DATETIME primitive in schema. MillisInstant logical type was then a workaround introduced, to enable Python xlang JdbcIO to r/w rows contain Timestamps. But it need to register the MillisInstant to overwrite the default mapping (MicrosInstant) --- That is what currently the integration does.

Since this has been a pain point. It may worth to include this line in the jdbc module. It will then make the MillisInstant supersedes MicrosInstant when jdbc module is imported.

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@Abacn
Copy link
Contributor Author

Abacn commented Oct 28, 2023

Run Python 3.11 PostCommit

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@Abacn
Copy link
Contributor Author

Abacn commented Oct 28, 2023

many row coder unit test failing e.g. apache_beam.coders.row_coder_test.RowCoderTest.test_batch_encode_decode I now remember this was the reason I could not set MillisInstant as default in #22561

(although all post commit passed which means jdbcio indeed no longer this workaround to work with Timestamp)

@Abacn Abacn marked this pull request as draft October 28, 2023 14:29
Copy link
Contributor

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 28, 2023
Copy link
Contributor

github-actions bot commented Jan 4, 2024

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant