Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14788#discussion_r83280122
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
 ---
    @@ -916,21 +931,26 @@ case class ToDate(child: Expression) extends 
UnaryExpression with ImplicitCastIn
     }
     
     /**
    - * Returns date truncated to the unit specified by the format.
    + * Returns timestamp truncated to the unit specified by the format.
      */
     // scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(date, fmt) - Returns returns date with the time portion 
of the day truncated to the unit specified by the format model fmt.",
    -  extended = "> SELECT _FUNC_('2009-02-12', 'MM')\n '2009-02-01'\n> SELECT 
_FUNC_('2015-10-27', 'YEAR');\n '2015-01-01'")
    +  usage = "_FUNC_(instant, fmt) - Returns returns date/timestamp with the 
time portion truncated to the unit specified by the format model fmt.",
    +  extended = "> SELECT _FUNC_('2009-02-12', 'MM')\n '2009-02-01 
00:00:00'\n> SELECT _FUNC_('2015-10-27', 'YEAR');\n '2015-01-01 00:00:00'")
     // scalastyle:on line.size.limit
    -case class TruncDate(date: Expression, format: Expression)
    +case class TruncInstant(instant: Expression, format: Expression)
    --- End diff --
    
    This auto casts. I think we are still breaking API here if a user passes a 
Timestamp. In the old situation the user would always get a Date, and now he 
gets a Date or Timestamp based on the input type. So I think we need to split 
this into two expressions.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to