24 Unstar Star 90 Fork 25

hellowzk / light-spark

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
Process1.scala 676 Bytes
Copy Edit Web IDE Raw Blame History
zhaokui authored 2020-08-06 17:33 . first commit
package com.hellowzk.light.spark.stages
import com.hellowzk.light.spark.stages.custom.CustomBaseInput
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession
/**
* <p>
* 日期: 2020/7/6
* <p>
* 时间: 17:43
* <p>
* 星期: 星期一
* <p>
* 描述:
* <p>
* 作者: zhaokui
**/
class Process1 extends CustomBaseInput {
override def process(rdd: RDD[String], name: String)(implicit ss: SparkSession): Unit = {
val filter = rdd.map(_.split(",", -1).map(_.trim)).filter(_.size == 3)
.map(cols => (cols(0), cols(1), cols(2)))
import ss.implicits._
filter.toDF("name", "gend", "age").createOrReplaceTempView(name)
}
}

Comment ( 0 )

Sign in for post a comment

Scala
1
https://gitee.com/hellowzk/light-spark.git
git@gitee.com:hellowzk/light-spark.git
hellowzk
light-spark
light-spark
master

Search

132457 8cb2edc1 1899542 131848 70c8d3a4 1899542