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

Deepti Antony commented on HIVE-3404:
-------------------------------------

We can add a UDF which will return the quarter in which a particular date lies.

Case 1 : hive> SELECT QUARTER ('2011-02-18')FROM TABLE_NAME ;
             >  1

Case 2: hive > SELECT * FROM  TABLE_NAME WHERE  QUARTER (date) = 2;

date|store_id|unit|value|price
2010-10-12 |11001|3|5.00|15.00
2011-02-18 |12001|4|6.00|24.00
2000-04-19 |11002|6|1.00|6.00
2012-05-21 |11002|8|1.00|8.00
2004-12-31|11003|2|3.00|6.00


RESULT:
2000-04-19 |11002|6|1.00|6.00
2012-05-21 |11002|8|1.00|8.00
                
> UDF to obtain the quarter of an year if a date or timestamp is given .
> ----------------------------------------------------------------------
>
>                 Key: HIVE-3404
>                 URL: https://issues.apache.org/jira/browse/HIVE-3404
>             Project: Hive
>          Issue Type: New Feature
>          Components: UDF
>            Reporter: Sanam Naz
>
> Hive current releases lacks a function which returns the quarter of an year 
> if a date or timestamp is given .The function QUARTER(date) would return the 
> quarter  from a date / timestamp .This can be used in HiveQL.This will be 
> useful for different domains like retail ,finance etc.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to