I'm using Beam (and Scio, though feel free to answer this question for PCollection
s too) to read from multiple tables in BigQuery. Because I'm reading multiple datasets from a dynamically generated list (it is itself an SCollection[String]
, where the String specifies the table name essentially), I wind up with an SCollection[SCollection[MyCoolDataType]]
.
Is there any way to flatten (union) these SCollection
objects into one? I've tried:
doubleCollection.reduce((col1, col2) => col1.union(col2))
and
sc.unionAll(doubleCollection)
but unfortunately an SCollection is not itself an iterable, so I think I may need to get more creative about mapping elements.