Uh oh!
There was an error while loading. Please reload this page.
[yaml] - add nullable field test for readFromBigQuery and update create core logic - #35692
Conversation
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
derrickaw
commented
Jul 25, 2025
Run Python_Integration PreCommit 3.9 |
derrickaw
commented
Jul 25, 2025
Run Xlang_Generated_Transforms PreCommit 3.9 |
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
derrickaw
commented
Jul 26, 2025
assign set of reviewers |
Assigning reviewers: R: @liferoad for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
| - {user: "bob", timestamp: 7} | ||
| # TODO - Rethink error handling since schema mismatch in Create transform | ||
| # isn't allowed anymore. |
There was a problem hiding this comment.
If I understand this correctly, typehints.Union will be used here when they have different schemas, right?
There was a problem hiding this comment.
In this particular case it will fail with types mismatch since two different types were used that were not nullable.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #35692 +/- ##
============================================
+ Coverage 56.53% 56.56% +0.03%
Complexity 3381 3381 ============================================
Files 1203 1204 +1 Lines 183895 183771 -124 Branches 3490 3490 ============================================
- Hits 103964 103951 -13 + Misses 76604 76493 -111
Partials 3327 3327
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| - type: Create | ||
| config: | ||
| elements: | ||
| - {sdk: MapReduce, year: 2004} |
There was a problem hiding this comment.
@damccorm this is related to what we discussed. We already have ValidateWithSchema for YAML, which can help validate the schema. But we do not have a way to define the schema. For example, here, year could be NULL but the inferred schema from Beam is Optional[Any], which cannot be accepted by WriteToBigQuery since WriteToBigQuery does not allow any type. We should do something like ValidateWithSchema that allows users to define the output schema.
| # - type: ValidateWithSchema | ||
| # input: Create | ||
| # config: | ||
| # schema: |
liferoad
commented
Jul 30, 2025
I recommend we close this PR for now and focus on defining the schema. |
derrickaw
commented
Jul 30, 2025
Hi @liferoad , I discussed with @damccorm offline and we were thinking that if we removed the hard check for multiple types, then this wouldn't be a breaking change anymore and would solve the issue with any type and nullability. Thoughts? |
liferoad
commented
Jul 30, 2025
Sounds good if we don't introduce a breaking change now. |
Run Python_Examples PreCommit 3.12 |
derrickaw
commented
Jul 30, 2025
Run Python_ML PreCommit 3.9 |
derrickaw
commented
Jul 30, 2025
Hi @liferoad - reverted the changes to assign_timestamp and validate_with_schema. |
liferoad
commented
Jul 30, 2025
/gemini review |
liferoad
commented
Jul 30, 2025
Please check the failed workflows. |
There was a problem hiding this comment.
Code Review
This pull request addresses issues related to type inference with nullable data, particularly for beam.Row objects. The changes in Create.infer_output_type to correctly handle Optional types are well-implemented. The addition of integration tests for ReadFromBigQuery with nullable data is also a valuable contribution.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
derrickaw
commented
Aug 1, 2025
Run Python_Coverage PreCommit |
liferoad
commented
Aug 1, 2025
looks like this breaks some of my new flatten tests: ![]() |
derrickaw
commented
Aug 1, 2025
Run Python_PVR_Flink PreCommit |
derrickaw
commented
Aug 1, 2025
Unit tests are flaky. |
liferoad
commented
Aug 1, 2025
#35764 fixes some issues. You can rebase. |

This PR solves two issues that are interconnected:
Note - removed some test coverage for AssignTimestamps and ValidateWithSchema transforms due to now throwing an error in Create due to this PR change. Commenting out for now. Also, ValidateWithSchema fails on any data that is Null. This should probably be fixed in a followup PR.
Tested locally:
/beam/sdks/python/apache_beam/yaml$ pytest -v integration_tests.py::BigqueryTest --test_files_dir="extended_tests/databases"
b/431833297
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.