Reputation: 1542
There are similar posts on Stack Overflow for the same question but none on a Java Spark Dataframe.
Can anyone help me with the same but in java.
I tried the solution posted here but its not working on Java. Seems like coalesce function takes Scala.collections.seq<columns>
as type. how to make it work in Java
Upvotes: 0
Views: 522
Reputation: 1542
I had to convert the columns to Seq to make it work in Java 8.
public Seq<Column> getSeqString(Column a, Column b)
{
ArrayList<Column> cols = new ArrayList<Column>();
cols.add(a);
cols.add(b);
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(cols).asScala().toBuffer();
}
Upvotes: 1