+1 to Brian's answer. In Java, you can
singleValuedPcollection .apply("Write single value", TextIO.write(). to(options.getSomeGcsPath()) as the last step of your pipeline. Then in your program, after executing the pipeline (wait until finish), use the Cloud Storage Java client library <https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-java> to read the file and extract the value. On Thu, Apr 22, 2021 at 10:45 AM Brian Hulette <bhule...@google.com> wrote: > I don't think there's an easy answer to this question, in general all you > can do with a PCollection is indicate you'd like to write it out to an IO. > There has been some work in the Python SDK on "Interactive Beam" which is > designed for using the Python SDK interactively in a notebook environment. > It will let you collect() a PCollection - meaning it runs the pipeline and > materializes the result. There's no such capability for the other SDKs > though. > > On Wed, Apr 21, 2021 at 8:24 PM Tao Li <t...@zillow.com> wrote: > >> Hi Beam community, >> >> >> >> This is the question I am asking: >> https://stackoverflow.com/questions/28015924/how-to-extract-contents-from-pcollection-in-cloud-dataflow >> >> >> >> Thanks! >> >