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

James Taylor commented on PHOENIX-1704:
---------------------------------------

Who is asking for this function? I'm not sure we need it. Probably better to 
support the more general and more standard EXTRACT function. We have a general 
way of inputting a DATE/TIME/TIMESTAMP based on a string (both with TO_DATE, 
TO_TIME, and TO_TIMESTAMP plus with DATE literals). Any other date built-in 
functions should work off of the DATE/TIME/TIMESTAMP type, not off of VARCHAR 
(as otherwise we're duplicating functionality we already have).

Note that the TRUNC/FLOOR/CEIL/ROUND built-ins already support the idea of 
converting an exact date to an exact multiple of time unit. See doc here: 
http://phoenix.apache.org/language/functions.html#trunc. This is similar to 
what we'd need to do for EXTRACT. Support for WEEK, MONTH, QUARTER, and YEAR 
would be useful.

> Add year() built-in function
> ----------------------------
>
>                 Key: PHOENIX-1704
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1704
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Alicia Ying Shu
>            Assignee: Alicia Ying Shu
>         Attachments: Phoenix-1704-v1.patch, Phoenix-1704.patch
>
>
> SELECT YEAR('2014-12-13 10:13:18', 'yyyy-MM-dd hh:mm:ss') FROM YEARFUNC  --> 
> 2014
> SELECT YEAR('2014-12-13') FROM YEARFUNC  --> 2014
> SELECT YEAR('Sat, 3 Feb 2014 03:05:06 GMT', 'EEE, d MMM yyyy HH:mm:ss z', 
> 'UTC') FROM YEARFUNC  --> 2014



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to