Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
696 views
in Technique[技术] by (71.8m points)

apache spark - How can I combine(concatenate) two data frames with the same column name in java

Can I append a dataframe to the right of other dataframe having same column names

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can join two dataframes like this.

df1.join(df2, df1.col("column").equalTo(df2("column")));

If you are looking for Union, then you can do something like this.

df1.unionAll(df2);  // spark 1.6

Spark 2.0, unionAll was renamed to union


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...