Spark Java convert Dataset to different type

Viewed 64

I hava a dataset of Type1 (Type1 has two fields a and b) mapped from csv.

Dataset<Type1> ds1

I want to operate on more columns - assigned in Type2 (a,b,c,d,e,f,g,h,i).

Dataset<Type2> ds2

In what way I can convert or map ds1 into ds2? Thank you for all advice.

1 Answers

Dataset ds2 = ds1.map(input -> new Type2(input.a, input.b))

Related