文章分类 -  Spark

摘要:import pyspark.sql.functions as func from pyspark.sql.window import Window func.rank().over(Window.orderBy(func.desc('total_time')) import pyspark.sql.functions as func from pyspark.sql.window... 阅读全文
posted @ 2018-10-25 10:35 桃源仙居 阅读(107) 评论(0) 推荐(0)
摘要:reduceByKey -- list I'm kind of late to the conversation, but here's my suggestion: >>> foo = sc.parallelize([(1, ('a','b')), (2, ('c','d')), (1, ('x','y'))]) >>> foo.map(lambda (x,y): (x, [y])).red... 阅读全文
posted @ 2018-06-22 22:00 桃源仙居 阅读(71) 评论(0) 推荐(0)
摘要:1. We translate your query to Spark SQL in the following way: from pyspark.sql.functions import mean, desc df.filter(df["country"] == "france") \ # only french stations .groupBy("station_id") \ #... 阅读全文
posted @ 2018-01-14 23:18 桃源仙居 阅读(76) 评论(0) 推荐(0)
摘要:转自:http://blog.csdn.net/sparkexpert/article/details/51042970 spark dataframe派生于RDD类,但是提供了非常强大的数据操作功能。当然主要对类SQL的支持。 在实际工作中会遇到这样的情况,主要是会进行两个数据集的筛选、合并,重新 阅读全文
posted @ 2017-10-10 15:25 桃源仙居 阅读(118) 评论(0) 推荐(0)
摘要:概述 1. Spark SQL是Spark的结构化数据处理模块。 2. Spark SQL特点 a) 数据兼容:可从Hive表、外部数据库(JDBC)、RDD、Parquet文件、JSON文件获取数据,可通过Scala方法或SQL方式操作这些数据,并把结果转回RDD。 b) 组件扩展:SQL语法解析 阅读全文
posted @ 2017-10-10 14:29 桃源仙居 阅读(148) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/yirenboy/article/details/47291765 https://databricks.gitbooks.io/databricks-spark-knowledge-base/content/best_practices/prefer_re 阅读全文
posted @ 2017-08-04 20:06 桃源仙居 阅读(144) 评论(0) 推荐(0)