You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "shunping (via GitHub)" <gi...@apache.org> on 2026/05/24 12:36:35 UTC
[PR] Fix flaky test_csv_to_json in Beam YAML SDK [beam]
shunping opened a new pull request, #38617:
URL: https://github.com/apache/beam/pull/38617
Below logs is from https://github.com/apache/beam/actions/runs/26350925447/job/77568997003?pr=38612
```
=================================== FAILURES ===================================
____________________ YamlTransformE2ETest.test_csv_to_json _____________________
[gw3] linux -- Python 3.11.15 /runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/target/.tox-py311/py311/bin/python
self = <apache_beam.yaml.yaml_transform_test.YamlTransformE2ETest testMethod=test_csv_to_json>
def test_csv_to_json(self):
try:
import pandas as pd
except ImportError:
raise unittest.SkipTest('Pandas not available.')
with tempfile.TemporaryDirectory() as tmpdir:
data = pd.DataFrame([{'label': f'{i}a', 'rank': i} for i in range(1024)])
input = os.path.join(tmpdir, 'input.csv')
output = os.path.join(tmpdir, 'output.json')
data.to_csv(input, index=False)
with open(input, 'r') as f:
lines = f.readlines()
_LOGGER.debug("input.csv has these {lines} lines.")
self.assertEqual(len(lines), len(data) + 1) # +1 for header
with beam.Pipeline() as p:
result = p | YamlTransform(
'''
type: chain
transforms:
- type: ReadFromCsv
config:
path: %s
- type: WriteToJson
config:
path: %s
num_shards: 1
- type: LogForTesting
''' % (repr(input), repr(output)))
all_output = list(glob.glob(output + "-*"))
file_and_size = {f: os.path.getsize(f) for f in all_output}
self.assertEqual(
len(all_output),
1,
msg=f"Expected 1 shard file, but found {len(all_output)}. "
f"Files & sizes (bytes): {file_and_size}")
output_shard = all_output[0]
result = pd.read_json(
output_shard, orient='records',
lines=True).sort_values('rank').reindex()
> pd.testing.assert_frame_equal(data, result)
apache_beam/yaml/yaml_transform_test.py:291:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
testing.pyx:55: in pandas._libs.testing.assert_almost_equal
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E AssertionError: DataFrame.index are different
E
E DataFrame.index values are different (48.53516 %)
E [left]: RangeIndex(start=0, stop=1024, step=1)
E [right]: Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
E ...
E 763, 764, 765, 766, 767, 768, 769, 770, 771, 772],
E dtype='int64', length=1024)
E At positional index 527, first diff: 527 != 773
testing.pyx:173: AssertionError
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky test_csv_to_json in Beam YAML SDK [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38617:
URL: https://github.com/apache/beam/pull/38617#issuecomment-4537304166
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky test_csv_to_json in Beam YAML SDK [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping merged PR #38617:
URL: https://github.com/apache/beam/pull/38617
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky test_csv_to_json in Beam YAML SDK [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #38617:
URL: https://github.com/apache/beam/pull/38617#issuecomment-4537298113
## Summary of Changes
Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses a flaky test in the Beam YAML SDK. The failure was caused by index mismatches during DataFrame comparison in the `test_csv_to_json` test, as `reindex()` was not properly resetting the index after sorting. The fix ensures the index is correctly reset to a sequential range, aligning it with the expected input data structure.
### Highlights
* **Test Fix**: Updated the `test_csv_to_json` test case in the Beam YAML SDK to use `reset_index(drop=True)` instead of `reindex()` when comparing DataFrames.
* **CI Trigger**: Incremented the revision number in `beam_PostCommit_Python_Versions.json` to trigger the test suite.
<details>
<summary><b>New Features</b></summary>
🧠You can now enable **Memory** (public preview) to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
</details>
<details>
<summary><b>Using Gemini Code Assist</b></summary>
<br>
The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
<b>Invoking Gemini</b>
You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
Feature | Command | Description
--- | --- | ---
Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help | `/gemini help` | Displays a list of available commands.
<b>Customization</b>
To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
<b>Limitations & Feedback</b>
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
</details>
[^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix flaky test_csv_to_json in Beam YAML SDK [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #38617:
URL: https://github.com/apache/beam/pull/38617#issuecomment-4537296650
r: @derrickaw since this is a follow-up fix of #38367
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org