You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Kostiantyn Kudriavtsev (JIRA)" <ji...@apache.org> on 2013/12/19 19:10:08 UTC

[jira] [Commented] (HIVE-3299) UDF DAYNAME(date) to HIVE

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

Kostiantyn Kudriavtsev commented on HIVE-3299:
----------------------------------------------

Please, take into account this is very specific user case. It makes sense to create as general as possible public to cover wide range of use cases. A few days ago I create ticket HIVE-6046 and working on that currently
I'm pretty sure HIVE-6046 gives possibility to get name from date as described in the current ticket 

> UDF  DAYNAME(date) to HIVE 
> ---------------------------
>
>                 Key: HIVE-3299
>                 URL: https://issues.apache.org/jira/browse/HIVE-3299
>             Project: Hive
>          Issue Type: New Feature
>          Components: UDF
>    Affects Versions: 0.9.0
>            Reporter: Namitha Babychan
>            Assignee: Carl Steinbach
>              Labels: patch
>         Attachments: HIVE-3299.1.patch.txt, HIVE-3299.patch.txt, Hive-3299_Testcase.doc, udf_dayname.q, udf_dayname.q.out
>
>
> Current releases of Hive lacks a function which would return the day name corresponding to a date / timestamp value which might be a part of a column.   
> The function -DAYNAME (date) would return the day name from a date / timestamp or column which would be useful while using HiveQL. This would find its use  in various business sectors like retail, which would help in  identifying the trends and sales datails for a particular weekday for entire year,month or week.
> Functionality :-
> Function Name: DAYNAME (date)
> 	 
> Returns the name of the weekday for date. 
> Example: hive> SELECT DAYNAME('2012-07-25');
>                    -> 'Wednesday'
> Usage :-
> Case 1 : To find DAY NAME corresponding to a particular date 
> hive> SELECT DAYNAME('2012-07-25');
>                    -> 'Wednesday'
> Case 2 : To query a table to find details based on a particular day name
> Table :-
> date      |item id|store id    |value|unit|price
> 01/07/2012|110001|0011111111003|0.99|1.00|0.99
> 02/07/2012|110001|0011111111008|0.99|0.00|0.00
> 03/07/2012|110001|0011111111009|0.99|0.00|0.00
> 04/07/2012|110001|0011111112002|0.99|0.00|0.00
> 05/07/2012|110001|0011111112003|0.99|0.00|0.00
> 06/07/2012|110001|0011111112006|0.99|1.00|0.99
> 07/07/2012|110001|0011111112007|0.99|0.00|0.00
> 08/07/2012|110001|0011111112008|0.99|0.00|0.00
> 09/07/2012|110001|0011111112009|0.99|0.00|0.00
> 10/07/2012|110001|0011111112010|0.99|0.00|0.00
> 11/07/2012|110001|0011111113003|0.99|0.00|0.00
> 12/07/2012|110001|0011111113006|0.99|0.00|0.00
> 13/07/2012|110001|0011111113008|0.99|0.00|0.00
> 14/07/2012|110001|0011111113010|0.99|0.00|0.00
> 15/07/2012|110001|0011111114002|0.99|0.00|0.00
> 16/07/2012|110001|0011111114004|0.99|1.00|0.99
> 17/07/2012|110001|0011111114005|0.99|0.00|0.00
> 18/07/2012|110001|0011111121004|0.99|0.00|0.00
> Query : select * from sales where dayname(date)='wednesday';
> Result :-
> 04/07/2012|110001|0011111112002|0.99|0.00|0.00
> 11/07/2012|110001|0011111113003|0.99|0.00|0.00
> 18/07/2012|110001|0011111121004|0.99|0.00|0.00



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)