【发布时间】:2022-01-17 07:13:50
【问题描述】:
我的数据是 s3 位置,正在尝试从 s3 读取数据
val repdate=spark.sql("select date_sub(current_timestamp(),1)")
println("repdate"+repdate)
输出或更新是 2021-12-11
但在 s3 位置它的 s3://qa/test1/12-11-2021/,尝试使用 date_format
import org.apache.spark.sql.functions._
val dfdate=date_format(repdate),"MM-DD-YYYY").as(format)
遇到错误
“类型不匹配”
val df=spark.read.format(""com.databricks.csv").option("header","true").
load(s"s3://bnsdfasdf/coa/dfdate/evvventz")
是否有使用 cast(unix_timestamp) 的简单解决方法?
试过了:
val repdate=spark.sql("select date_sub(current_timestamp(),1)")
import org.apache.spark.sql.functions._
val dfdate=(""" select date_format(repdate),"MM-DD-YYYY").as(format) """)
但是得到的路径不存在
【问题讨论】:
标签: scala apache-spark pyspark apache-spark-sql