phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Belousov <sergey.belou...@gmail.com>
Subject CASTing epoch (UNSIGNED_LONG) to TIMESTAMP
Date Fri, 13 Mar 2015 00:56:59 GMT
Hi All

I have some weird thing going on and hope somebody can help here.

HBase shell:

create 't','f1'
put
't',"\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x01L\x0Fz,\x1E",'f1:c1','test'

sqlline:

CREATE VIEW vT
(   a UNSIGNED_INT NOT NULL
   ,b UNSIGNED_INT NOT NULL
   ,ts UNSIGNED_LONG NOT NULL
CONSTRAINT pk PRIMARY KEY (a, b, ts))
AS SELECT * FROM "t"
DEFAULT_COLUMN_FAMILY ='f1';

 select a, b, ts, CAST(1426188807198 AS TIMESTAMP) from vt;
+----+----+----------------+------------------------------+
| A  | B  |       TS       | TO_TIMESTAMP(*1426188807198*)  |
+----+----+----------------+------------------------------+
| 1  | 1  | *1426188807198  *| 2015-03-12 19:33:27.198      |
+----+----+----------------+------------------------------+

but

select a, b, ts, CAST(ts AS TIMESTAMP) from vt;
Error: ERROR 203 (22005): Type mismatch. UNSIGNED_LONG and TIMESTAMP for TS
(state=22005,code=203)

So questions is
1. Why CAST from VIEW does not work and should it?
2. TO_TIMESTAMP internal function? (I can not do TO_TIMESTAMP() in query)

Thank you
SB

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message