package scala
import com.google.gson.{Gson, JsonObject, JsonParser}
import org.apache.spark.sql.{Row, SaveMode, SparkSession}
object CsvParse {
case class Data(callerip: String,callere164: String, calleee164: String, starttime: String,
stoptime: String, holdtime: String, feetime: String, fee: String,
enddirection: String, endreason: String)
def main(args: Array[String]): Unit = {
val spark = SparkSession.builder().master("local[*]").appName("SparkCsv").getOrCreate();
import spark.implicits._
val df = spark.read.option("header", "true").csv("D:\\tmp\\home2").select("callerip", "callere164", "calleee164", "starttime", "stoptime",
"holdtime", "feetime", "fee", "enddirection", "endr
spark读取csv文件用类进行封装最后转成json写出到本地
最新推荐文章于 2024-06-26 09:48:23 发布