摘要:
今天碰到一个问题,需要通过JDBC链接数据库,使用Spark读取并处理数据,想到使用JdbcRDD,JdbcRDD的类定义如下private[spark] class JdbcPartition(idx: Int, val lower: Long, val upper: Long) extends ... 阅读全文
摘要:
Spark读入本地文件后,成为MapPartitionsRDD,可以使用zipWithIndex,转换成ZippedWithIndexRDD:查看结果,每一行变为二元组“(内容,索引)”,索引从0开始:(# Apache Spark,0)("",1)(Spark is a fast and gene... 阅读全文