标签:map ESS pre pac 修改 class ast def apach
package classifierAlg import config.conf.{sc, spark_session} import config.conf.spark_session.implicits._ import org.apache.spark.sql.functions._ import org.apache.spark.sql.types._ import org.apache.spark.sql.{Column, DataFrame} object euclideanDist { def main(args: Array[String]): Unit = { val path:String = "data/irsdf/part-00000-ca2d6ce7-bcd0-4c24-aba9-e8cb01dcc04c-c000.csv" val df: DataFrame = spark_session.read.csv(path).toDF("ft1","ft2","ft3","ft4","label") val cols: Array[String] = df.columns val n: Int = cols.length // val colNames : Array[String] = df.schema.fieldNames val colsd: Array[Column] = cols.map(f => df(f).cast(DoubleType)) val df2: DataFrame = df.select(colsd: _*) df2.printSchema() } }
标签:map ESS pre pac 修改 class ast def apach
原文地址:https://www.cnblogs.com/wuzaipei/p/12625471.html