Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: beam.io.WriteToCsv ignores num_shards argument. #34188

Open
1 of 17 tasks
ganesh4991 opened this issue Mar 6, 2025 · 4 comments
Open
1 of 17 tasks

[Bug]: beam.io.WriteToCsv ignores num_shards argument. #34188

ganesh4991 opened this issue Mar 6, 2025 · 4 comments

Comments

@ganesh4991
Copy link

ganesh4991 commented Mar 6, 2025

What happened?

beam.io.WriteToCsv does not take respect the num_shards argument while writing the output. The workaround for now is to use beam.io.WriteToText instead.

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@Rupsa1234
Copy link

Thanks for reporting this issue! I have also encountered the same problem where WriteToCsv does not respect the num_shards parameter, causing all data to be written to a single file instead of multiple shards.

I tested this with Apache Beam Python SDK 2.49.0 on Google Dataflow Runner and observed:

  • Expected: output-00000-of-00005.csv, output-00001-of-00005.csv, etc.
  • Actual: Only one output.csv file is generated.

Workaround:
Using WriteToText instead solves the issue:
p | "Write to Text" >> beam.io.WriteToText("output", file_name_suffix=".csv", num_shards=5)

@Rupsa1234
Copy link

can i work upon this?

@ganesh4991
Copy link
Author

cc @tvalentyn

@liferoad
Copy link
Contributor

liferoad commented Mar 6, 2025

@Rupsa1234 feel free to take it. https://beam.apache.org/contribute/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants