dataframe中head() first() take() collect() show() tail() limit()的关系

first()  = head(1)   head() 底层调用 take()

show()  底层调用的take() 多了一层类型转换 将值转化为字符串    多了truncate参数,截取字符串功能

take()  调用 collect() + limit()

collect()触发runjob()执行任务

tail()  返回dataframe最后一行,可能会OOM

 

方法及源码截图和部分函数描述

collect()

dataframe中head() first() take() collect() show() tail() limit()的关系

limit()

dataframe中head() first() take() collect() show() tail() limit()的关系

take()

Take the first num elements of the RDD.

dataframe中head() first() take() collect() show() tail() limit()的关系

show()  底层调用的take() 多了一层类型转换 将值转化为字符串    多了truncate参数,截取字符串功能

dataframe中head() first() take() collect() show() tail() limit()的关系

tail()

dataframe中head() first() take() collect() show() tail() limit()的关系

head()

dataframe中head() first() take() collect() show() tail() limit()的关系

first()

/**

* Return the first element in this RDD.

*/

dataframe中head() first() take() collect() show() tail() limit()的关系