scala经常使用操做

scala经常使用操做

版本信息
python3.7
pyspark2.4.0python

from pyspark import SQLContext,SparkContext,SparkConf

conf = SparkConf()
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)
#加载csv文件
data = sqlContext.read.format("csv").option("header","true").load("union_order_user")
#按字段降序排序
sorted=data.sort("created_at",ascending = False)
#展现前100条记录 默认展现20条
sorted.show(100)
相关文章
相关标签/搜索