spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 杨仲鲍 <gear1...@icloud.com.INVALID>
Subject Confuse on Spark to_date function
Date Thu, 05 Nov 2020 03:48:45 GMT

Code

```scala
object Suit {
  case class Data(node:String,root:String)
  def apply[A](xs:A *):List[A] = xs.toList
  def main(args: Array[String]): Unit = {

    val spark = SparkSession.builder()
      .master("local")
      .appName("MoneyBackTest")
      .getOrCreate()
    import spark.implicits._
    spark.sql("select to_date('2020-01-01 20:00:00','yyyy-MM-dd HH:mm:ss')").show(false)
  }
}
```

result

```output

+-----------------------------------------------------+
|to_date('2020-01-01 20:00:00', 'yyyy-MM-dd HH:mm:ss')|
+-----------------------------------------------------+
|2020-01-01                                           |
+-----------------------------------------------------+
```

Why not show 2020-01-01 20:00:00

sparkVersion:2.4.4
Device:MacBook
Mime
View raw message