Problem Statement:
I have an input PCollection with following fields:
{
firstname_1,
lastname_1,
dob,
firstname_2,
lastname_2,
firstname_3,
lastname_3,
}
then I execute a Beam SQL operation such that output of resultant PCollection should be like
----------------------------------------------
name.firstname | name.lastname | dob
----------------------------------------------
firstname_1 | lastname_1 | 202009
firstname_2 | lastname_2 |
firstname_3 | lastname_3 |
-----------------------------------------------
To be precise:
array[
(firstname_1,lastname_1,dob),
(firstname_2,lastname_2,dob),
(firstname_3,lastname_3,dob)
]
Here is the code snippet where I execute Beam SQL:
PCollectionTuple tuple=
PCollectionTuple.of(new TupleTag<>("testPcollection"), testPcollection);
PCollection<Row> result = tuple
.apply(SqlTransform.query(
"SELECT array[(firstname_1,lastname_1,dob), (firstname_2,lastname_2,dob), (firstname_3,lastname_3,dob)]"));
I am not getting proper results.
Can someone guide me how to query an array of repeated field in Beam SQL?