Fix beam.Row.__eq__ for rows with trailing columns#23876
Fix beam.Row.__eq__ for rows with trailing columns#23876damccorm merged 2 commits intoapache:masterfrom
Conversation
|
Fixes #23875 |
|
Assigning reviewers. If you would like to opt out of this review, comment R: @tvalentyn for label python. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
sdks/python/apache_beam/pvalue.py
Outdated
There was a problem hiding this comment.
I think we'd like to check the order in which elements were added to the dictionary as per #14156 . Is that the case, @TheNeuralBit ?
If so, we could instead add another condition to make sure dicts has equal # of elements.
Would be nice to add a unit test for this case as well.
There was a problem hiding this comment.
I think items will take order into account. But it would be good to have a simple unit test that verifies beam.Row(x=1, y=2) != beam.Row(y=2. x=1).
There was a problem hiding this comment.
I added a test test and went ahead with my suggestion. relying on items() alone was not sufficient.
|
PTAL at the formatting / lint failures. you can click on Details -> Console output to see the errors. see also s.apache.org/beam-python-dev-wiki for tips on autoformatting. |
|
Do you need more help here? This seems like a potentially important fix. |
|
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 dev@beam.apache.org list. Thank you for your contributions. |
Codecov Report
@@ Coverage Diff @@
## master #23876 +/- ##
==========================================
- Coverage 72.89% 72.89% -0.01%
==========================================
Files 746 746
Lines 99270 99270
==========================================
- Hits 72365 72362 -3
- Misses 25542 25545 +3
Partials 1363 1363
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Would be great to finish this up. If @aliftadvantage does not have time any more, maybe one of the reviewers could make the remaining changes? Is it close? |
71cc782 to
3be1c5d
Compare
|
Run Python_PVR_Flink PreCommit |
1 similar comment
|
Run Python_PVR_Flink PreCommit |
|
R: @damccorm |
The
beam.Row.__eq__operator had unexpected behavior when the rows had a different number of columns.Specifically the case:
beam.Row(x=1, y=2) == beam.Row(x=1, y=2, z=3)returns true.This is because zip() drops the trailing columns from the row that has more columns. When all rows are equal trailing rows are ignored and a
__eq__call returns true.Fix was to replace zip with comparison of the lists of dict items.
cc @robertwb