apache / apache/beam

Add support for side inputs/outputs to Java 8 lambdas in MapElements

Open
#18,085 0 comments 0 reactions 0 assignees View on GitHub
improvement P3 sdk-ideas
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

Currently there's no way to use side inputs or outputs within Java 8 lambdas and MapElements. It would be nice if you could do something like this:

```

PCollection wordLengths = words.apply(
MapElements.via((String word) -> {
int sideInput1=
[[[ GetSideInputHere(); ]]]
[[[ SetSideOutputHere ]]] (sideInput1+word.length());
return
word.length();
}).withOutputType(new TypeDescriptor() {});

```

Imported from Jira [BEAM-656](https://issues.apache.org/jira/browse/BEAM-656). Original Jira may contain additional context.
Reported by: jpatokal.

Contributor guide

Open the contributing guide

Research direction

Start with the MapElements API and its Java 8 lambda support, then consult the linked BEAM-656 Jira issue for context not included here. Done means Java 8 lambdas used with MapElements can access side inputs and produce side outputs while preserving the main output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.