我有:
val DF1 = sparkSession.sql("select col1,col2,col3 from table");
val tupleList = DF1.select("col1","col2").rdd.map(r => (r(0),r(1))).collect()
tupleList.foreach(x=> x.productIterator.foreach(println))
但我没有得到输出中的所有元组。问题出在哪里?
col1 col2
AA CCC
AA BBB
DD CCC
AB BBB
Others BBB
GG ALL
EE ALL
Others ALL
ALL BBB
NU FFF
NU Others
Others Others
C FFF
我得到的输出是:CCC AA BBB AA Others AA Others DD ALL Others ALL GG ALL ALL
2条答案
按热度按时间c3frrgcw1#
egdjgwm82#
解决使用pysppark时出现的无效语法问题