[ 
https://issues.apache.org/jira/browse/SPARK-22478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16245748#comment-16245748
 ] 

Marco Gaido commented on SPARK-22478:
-------------------------------------

The reason why {{TRUNC}} works like this is for compatibility with Hive, where 
the same function works the same way. You can achieve your goal in other ways, 
like using {{date_format}} to get a string with the information you need or you 
can use the {{HOUR}} function, or you can even create your UDF to achieve this.

> Spark  - Truncate date by Day / Hour
> ------------------------------------
>
>                 Key: SPARK-22478
>                 URL: https://issues.apache.org/jira/browse/SPARK-22478
>             Project: Spark
>          Issue Type: New Feature
>          Components: Spark Core
>    Affects Versions: 2.2.0
>            Reporter: david hodeffi
>            Priority: Trivial
>
> Currently it is possible to truncate date/timestamp only by month or year,
> There is a missing functionality to truncate by hour/day.
> A usecase that requires this functionality is: Aggregating financial 
> transaction of a party in order to create daily/hour summary. 
> Those summaries are required for machine learning algorithms.  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to