Repository navigation
Conversation
Query 1 multiplied the bid price by a float, so the converted Bid could not be encoded by BidCoder, which writes the price as a varint. Use the same integer arithmetic as the Java Query 1. Fixes apache#24678
Contributor
|
Assigning reviewers: R: @tvalentyn 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24678
Python Nexmark Query 1 converts bid prices with
bid.price * 0.89, which turns the price into a float.BidCoderwrites the price withVarIntCoderImpl, so encoding the converted bid fails with:The Java version of the query does integer math,
(bid.price * 89) / 100. This change does the same in Python with(bid.price * 89) // 100, so the result is still an int and matches the Java output.I also added
query1_test.py. It runs the query on a couple of bids and sends the results throughBid.CODER. It fails with the error above before the change and passes after it.Testing:
pytest apache_beam/testing/benchmarks/nexmark/queries/query1_test.pyyapf --diffandruff checkon the changed filesThank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123orfixes #456).CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.