raams95 opened a new pull request, #40548:
URL: https://github.com/apache/beam/pull/40548

   Fixes #24678
   
   Python Nexmark Query 1 converts bid prices with `bid.price * 0.89`, which 
turns the price into a float. `BidCoder` writes the price with 
`VarIntCoderImpl`, so encoding the converted bid fails with:
   
   ```
   TypeError: unsupported operand type(s) for &: 'float' and 'int'
   ```
   
   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 through `Bid.CODER`. It fails with the error above before the 
change and passes after it.
   
   Testing:
   - `pytest apache_beam/testing/benchmarks/nexmark/queries/query1_test.py`
   - `yapf --diff` and `ruff check` on the changed files
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
    - [x] Mention the appropriate issue in your description (for example: 
`addresses #123` or `fixes #456`).
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to