val conf = new SparkConf().setAppName("ProductPrivilege").setMaster("local[1]")
//创建spark执行的入口
val sc = new SparkContext(conf)
val session = SparkSession
.builder()
.enableHiveSupport()
.getOrCreate()
val rdd = sc.textFile("/Users/admin/.../product_info_test.txt")
val rddSolve = rdd.map(x => {
val item = x.split(",").toList
val productId = item.head.toLong
val shopId = item.apply(1).toLong
val status = item.apply(2).toInt
Row(productId, shopId, status)
})
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/245730.html