DataflowJavaSDK icon indicating copy to clipboard operation
DataflowJavaSDK copied to clipboard

ordered side input

Open sammoes opened this issue 10 years ago • 5 comments

Needing to pass some data as Side Input, I would like to pass the data in an ordered fashion but final PCollectionView<List> sams = sams.apply(View.asList()); is really inflexible in that respect. There is a workaround, but here it has to do with List not having an order. Unfortunately, achieving this: final PCollectionView<ArrayList> sams = sams.apply(View.asList()); requires extending half the SDK. ** We are passing the data as side input because of its immutability. Combined with the order, that ensures that the data goes into the next stage completely.

sammoes avatar Jun 06 '16 20:06 sammoes

If the list is really small, use View.asSingleton(...) with a sorted list coder or stick with View.asList(...) and just create a sorted list inside the DoFn.

If you only care about some of the elements in the list (smallest, largest, ...), pass the elements through a function like Top to filter out the majority and then use View.asSingleton(...) with a sorted list coder or stick with View.asList(...) and just create a sorted list inside the DoFn.

If your list is large and you need to traverse the majority of it in some sorted way, can you give further details as to how you want to traverse and why?

lukecwik avatar Jun 06 '16 20:06 lukecwik

The list is very large. We did do the 'just create a sorted list inside the DoFn', that's the workaround I mentioned. I want to traverse it as an ArrayList. Since List doesn't have an order, nor does Map or MultiMap, this issue would be to add a sorted Collection to the SDK.

sammoes avatar Jun 07 '16 05:06 sammoes

If you would see the code, you would understand why this is like a bug in the SDK.

sammoes avatar Jun 08 '16 13:06 sammoes

Need more details about what the problem you are trying to solve (potentially code snippets) otherwise will leave this as a feature request to add support for ordered side input views.

lukecwik avatar Jun 08 '16 16:06 lukecwik

Resolving due to inactivity

lukecwik avatar Aug 10 '16 20:08 lukecwik