Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/14788#discussion_r76511635
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
---
@@ -916,21 +953,26 @@ case class ToDate(child: Expression) extends
UnaryExpression with ImplicitCastIn
}
/**
- * Returns date truncated to the unit specified by the format.
+ * Returns date/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.",
+ 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'\n> SELECT
_FUNC_('2015-10-27', 'YEAR');\n '2015-01-01'")
// scalastyle:on line.size.limit
-case class TruncDate(date: Expression, format: Expression)
+case class TruncDate(instant: Expression, format: Expression)
--- End diff --
It's weird that `TruncDate` can truncate timestamp, can you double check
with other databases?
---
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]