I have PCollection of type String and I want to transform this to get values of specific column from BigQuery table. So I used BigQueryIO.readTableRows to get values from BigQuery.
Here is my code:
PCollection getConfigTable = pipeline.apply("read from Table",
BigQueryIO.readTableRows().from("TableName"));
RetrieveDestTableName retrieveDestTableName = new RetrieveDestTableName();
PCollection getDestTableName = getConfigTable.apply(ParDo.of(new DoFn() {
@ProcessElement
public void processElement(ProcessContext c) {
c.output(c.element().get("ColumnName").toString());
}
}));
As per above code I will get an output from getDestTableName of type PCollection, but I want this output in a String variable.
Is there any way to convert PCollection to String datatype variable so that I can able to use variable in my code?