Suppose i have a dataset :
+----+----+----+-----+----+
||col0|col2|col2|col3|col4|
+----+----+----+-----+----+
| t0| 10| 100|cat26|30.9|
| t1| 20| 200|cat13|22.1|
| t2| 30| 300|cat26|30.9|
| t3| 40| 400|cat26|30.9|
| t4| 50| 500|cat15|15.3|
| t5| 60| 600|cat13|22.1|
+----+----+----+-----+----+
I select a sub-dataset using where()
:
Dataset<Row> subDf = dF.where("col3 = cat26 ");
Yielding :
+----+----+----+-----+----+
|col0|col2|col2|col3 |col4|
+----+----+----+-----+----+
| t0| 10| 100|cat26|30.9|
| t2| 30| 300|cat26|30.9|
| t3 | 40| 400|cat26|30.9|
+----+----+----+-----+----+
I want to create different combinations using these three rows to form for each combination a dataset.
An example of a combination is as follow :
+----+----+----+-----+----+
|col0|col2|col2|col3 |col4|
+----+----+----+-----+----+
| t0| 10| 100|cat26|30.9|
| t2| 30| 300|cat26|30.9|
+----+----+----+-----+----+
Another one is :
+----+----+----+-----+----+
|col0|col2|col2|col3 |col4|
+----+----+----+-----+----+
| t2| 30| 300|cat26|30.9|
| t3| 40| 400|cat26|30.9|
+----+----+----+-----+----+
Third possible combination is as follows:
+----+----+----+-----+----+
|col0|col2|col2|col3 |col4|
+----+----+----+-----+----+
| t0| 10| 100|cat26|30.9|
| t3| 40| 400|cat26|30.9|
+----+----+----+-----+----+
And last :
+----+----+----+-----+----+
|col0|col2|col2|col3 |col4|
+----+----+----+-----+----+
| t0| 10| 100|cat26|30.9|
| t2| 30| 300|cat26|30.9|
| t3 | 40| 400|cat26|30.9|
+----+----+----+-----+----+
PS : in the previous example each combination (a dataset) had at least two rows,
How to achieve just that in JAVA ? Thank you. .