3
votes

The code starts like this:

return pcol.apply(ParDo.named("FindTheBug")
        .withSideInputs(foo)
        .withSideInputs(bar(
        .of(new DoFn<T, U>() {
            F myFoo = c.sideInput(foo);
            B myBar = c.sideInput(bar);

These side inputs are declared, why doesn't Dataflow see them?

2

2 Answers

7
votes

It turns out that calling withSideInputs more than once is not allowed. The code should instead look like this:

return pcol.apply(ParDo.named("FindTheBug")
        .withSideInputs(foo, bar)
        .of(new DoFn<T, U>() {
            // now you can access both side inputs

The hint is that the function's called "withSideInputs", not "withSideInput". This tripped me more than once and isn't googleable, so I thought I'd write it down in case someone else runs into this!

3
votes

Also, this error happen when one forgot to call withSideInputs.