phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serhiy Bilousov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-1704) Add year() built-in function
Date Sat, 07 Mar 2015 16:44:38 GMT

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

Serhiy Bilousov commented on PHOENIX-1704:
------------------------------------------

If that a case documentation mentions only TO_DATE http://phoenix.apache.org/language/functions.html#to_date
and again it accept only string. 
Here what I was attempting to do 

create table dev.t2 (f_long UNSIGNED_LONG NOT NULL,f_ts TIMESTAMP NOT NULL, CONSTRAINT pk
PRIMARY KEY (f_long,f_ts)); 

--another issue probably
upsert into dev.t2 values (1425744792000,1425744792000);
Error: ERROR 203 (22005): Type mismatch. TIMESTAMP and BIGINT for 1425744792000 (state=22005,code=203)

--
upsert into dev.t2 values (CAST (1425744792000 AS UNSIGNED_LONG),CAST (1425744792000 AS TIMESTAMP));
upsert into dev.t2 values (CAST (1394049227000 AS UNSIGNED_LONG),CAST (1394049227000 AS TIMESTAMP));


 select * from dev.t2;
+------------------------------------------+------------------------------------------+
|                  F_LONG                  |                   F_TS                   |
+------------------------------------------+------------------------------------------+
| 1394049227000                            | 2014-03-05 19:53:47.0                    |
| 1425744792000                            | 2015-03-07 16:13:12.0                    |
+------------------------------------------+------------------------------------------+


select to_date(f_ts, 'yyy-mm-dd') from dev.t2;
Error: ERROR 203 (22005): Type mismatch. expected: [VARCHAR] but was: TIMESTAMP at TO_DATE
argument 1 (state=22005,code=203)

select to_date(f_long, 'yyy-mm-dd') from dev.t2;
Error: ERROR 203 (22005): Type mismatch. expected: [VARCHAR] but was: UNSIGNED_LONG at TO_DATE
argument 1 (state=22005,code=203)

select to_date(cast (f_ts AS VARCHAR), 'yyy-mm-dd') from dev.t2;
Error: ERROR 203 (22005): Type mismatch. TIMESTAMP and VARCHAR for F_TS (state=22005,code=203)

select to_date(cast (f_long AS VARCHAR), 'yyy-mm-dd') from dev.t2;
Error: ERROR 203 (22005): Type mismatch. UNSIGNED_LONG and VARCHAR for F_LONG (state=22005,code=203)



> 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)

Mime
View raw message