phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Batyrshin Alexander <0x62...@gmail.com>
Subject Re: Row timestamp
Date Sat, 11 Mar 2017 13:34:58 GMT
So main idea behind of "Row Timestamp" feature is to give ability to set HBase cell timestamp
via UPSERT?
Is it possible to get cell timestamp for already created HBase table with row keys without
timestamp?

As for example. I tried to execute query from page:

0: jdbc:phoenix:> CREATE TABLE DESTINATION_METRICS_TABLE (CREATED_DATE NOT NULL DATE, METRIC_ID
NOT NULL CHAR(15), METRIC_VALUE LONG CONSTRAINT PK PRIMARY KEY(CREATED_DATE ROW_TIMESTAMP,
METRIC_ID)) SALT_BUCKETS = 8;
Error: ERROR 601 (42P00): Syntax error. Encountered "NOT" at line 1, column 54. (state=42P00,code=601)

Fixed query is: CREATE TABLE DESTINATION_METRICS_TABLE (CREATED_DATE DATE NOT NULL , METRIC_ID
CHAR(15) NOT NULL , METRIC_VALUE UNSIGNED_LONG CONSTRAINT PK PRIMARY KEY(CREATED_DATE ROW_TIMESTAMP,
METRIC_ID)) SALT_BUCKETS = 8;

> On 10 Mar 2017, at 19:39, Samarth Jain <samarth.jain@gmail.com> wrote:
> 
> This is because you are using now() for created. If you used a different date then with
TEST_ROW_TIMESTAMP1, the cell timestamp would be that date where as with TEST_ROW_TIMESTAMP2
it would be the server side time.
> 
> Also, which examples are broken on the page?
> 
> On Thu, Mar 9, 2017 at 11:28 AM, Batyrshin Alexander <0x62ash@gmail.com <mailto:0x62ash@gmail.com>>
wrote:
>  Hello,
> Im trying to understand what excatly Phoenix row timestamp is
> I created 2 tables for test:
> 
> CREATE TABLE test_row_timestamp1(
>     id varchar NOT NULL,
>     created TIMESTAMP NOT NULL,
>     foo varchar,
>     CONSTRAINT PK PRIMARY KEY( id, created ROW_TIMESTAMP )
> )
> 
> CREATE TABLE test_row_timestamp2(
>     id varchar NOT NULL,
>     created TIMESTAMP NOT NULL,
>     foo varchar,
>     CONSTRAINT PK PRIMARY KEY( id, created )
> )
> 
> upsert into test_row_timestamp1 (id, created, foo) values ('1', now(), 'bar');
> upsert into test_row_timestamp2 (id, created, foo) values ('1', now(), 'bar');
> 
> And result is:
> 
> hbase(main):004:0> scan 'TEST_ROW_TIMESTAMP1', { LIMIT=>10}
> ROW                                                              COLUMN+CELL
>  1\x00\x80\x00\x01Z\xB4\x80:6\x00\x00\x00\x00                    column=0:FOO, timestamp=1489086986806,
value=bar
>  1\x00\x80\x00\x01Z\xB4\x80:6\x00\x00\x00\x00                    column=0:_0, timestamp=1489086986806,
value=x
> 
> hbase(main):005:0> scan 'TEST_ROW_TIMESTAMP2', { LIMIT=>10}
> ROW                                                              COLUMN+CELL
>  1\x00\x80\x00\x01Z\xB4\x80M\xE6\x00\x00\x00\x00                 column=0:FOO, timestamp=1489086991848,
value=bar
>  1\x00\x80\x00\x01Z\xB4\x80M\xE6\x00\x00\x00\x00                 column=0:_0, timestamp=1489086991848,
value=x
> 
> Both tables has the same row key pattern id + 0x00 + timestamp
> I expect that test_row_timestamp1 will utilise native hbase timestamp that is part of
"real" hbase key.
> 
> 
> PS. Examples at https://phoenix.apache.org/rowtimestamp.html <https://phoenix.apache.org/rowtimestamp.html>
are broken
> 


Mime
View raw message