You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "junaiddshaukat (via GitHub)" <gi...@apache.org> on 2026/01/24 06:07:32 UTC
[I] [Feature Request]: Add filter() method to PCollection in TypeScript SDK [beam]
junaiddshaukat opened a new issue, #37407:
URL: https://github.com/apache/beam/issues/37407
### What would you like to happen?
## Summary
Add a `filter()` method to the `PCollection` class in the TypeScript SDK, consistent with the existing `map()` and `flatMap()` methods.
## Motivation
The TypeScript SDK currently provides `map()` and `flatMap()` methods on `PCollection`, but lacks a `filter()` method. This is explicitly mentioned as a TODO in the README-dev.md:
> "Also add a [do]Filter, and possibly a [do]Reduce?"
The Python SDK already provides `beam.Filter()` for this purpose. Adding `filter()` to the TypeScript SDK would:
1. **Improve developer experience** - JavaScript developers expect `filter()` alongside `map()`
2. **Improve code readability** - `pcoll.filter(x => x > 0)` is cleaner than `pcoll.flatMap(x => x > 0 ? [x] : [])`
3. **Maintain consistency** with the Python SDK which has `beam.Filter()`
## Proposed API
// Filter even numbers
const evens = pcoll.filter(x => x % 2 === 0);
// Filter with context (for side inputs, etc.)
const filtered = pcoll.filter((x, ctx) => x > ctx.threshold, { threshold: sideInput });
### Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [x] 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
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature Request]: Add filter() method to PCollection in TypeScript SDK [beam]
Posted by "junaiddshaukat (via GitHub)" <gi...@apache.org>.
junaiddshaukat commented on issue #37407:
URL: https://github.com/apache/beam/issues/37407#issuecomment-3793912552
.take-issue
--
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: [I] [Feature Request]: Add filter() method to PCollection in TypeScript SDK [beam]
Posted by "junaiddshaukat (via GitHub)" <gi...@apache.org>.
junaiddshaukat commented on issue #37407:
URL: https://github.com/apache/beam/issues/37407#issuecomment-3793931513
Hi @damccorm
This PR adds a `filter()` method to `PCollection`, addressing the TODO in README-dev.md. It follows the same pattern as `map()` and `flatMap()` with 5 test cases covering various scenarios.
Fixes #37407
Would appreciate your review when you have time. Thanks!
--
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: [I] [Feature Request]: Add filter() method to PCollection in TypeScript SDK [beam]
Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm closed issue #37407: [Feature Request]: Add filter() method to PCollection in TypeScript SDK
URL: https://github.com/apache/beam/issues/37407
--
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