Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7644#discussion_r35490360
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeFunctions.scala
---
@@ -247,14 +248,112 @@ case class DateFormatClass(left: Expression, right:
Expression) extends BinaryEx
override protected def nullSafeEval(timestamp: Any, format: Any): Any = {
val sdf = new SimpleDateFormat(format.toString)
- UTF8String.fromString(sdf.format(new Date(timestamp.asInstanceOf[Long]
/ 1000)))
+ UTF8String.fromString(sdf.format(new
java.util.Date(timestamp.asInstanceOf[Long] / 1000)))
}
override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode):
String = {
val sdf = classOf[SimpleDateFormat].getName
defineCodeGen(ctx, ev, (timestamp, format) => {
s"""UTF8String.fromString((new $sdf($format.toString()))
- .format(new java.sql.Date($timestamp / 1000)))"""
+ .format(new java.sql.Timestamp($timestamp / 1000)))"""
--- End diff --
why is this changed to Timestamp?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]