2015-11-02 93 views
0

我正在为phoenix编写upsert脚本来制作hbase中的记录。菲尼克斯插入hbase的时间戳格式?

CREATE TABLE IF NOT EXISTS temp.table (
id bigint(20), 
created_at timestamp, 
updated_at timestamp, 
CONSTRAINT pk PRIMARY KEY (id) 
); 

当我使用UPSERT脚本

upsert into temp.table values(1000,'2014-07-30 13:33:45','2014-07-30 13:33:45'); 

我收到以下错误

Error: ERROR 203 (22005): Type mismatch. TIMESTAMP and VARCHAR for 2014-07-30 13:33:45 (state=22005,code=203) 

当我使用

upsert into temp.table values(1000,13907665544,13907665544); 

我得到的错误

Error: ERROR 203 (22005): Type mismatch. TIMESTAMP and LONG for 13907665544 (state=22005,code=203) 

当列有timestamp时,写入upsert脚本的其他形式是什么?

回答

1

再次检查您的查询。你应该从

upsert into temp.test_table(1000,'2014-07-30 13:33:45','2014-07-30 13:33:45'); 

改变你的查询

upsert into temp.test_table values (1000,'2014-07-30 13:33:45','2014-07-30 13:33:45'); 
sqlline版本测试

1.1.8

而且我从temp.table改表名作为temp.test_table这是给我出现以下错误

org.apache.phoenix.exception.PhoenixParserException: ERROR 604 (42P00): Syntax error. Mismatched input. Expecting "NAME", got "table" at line 1, column 33. 

1

+0

还是不行。在我的问题中存在拼写错误,我忘了在括号前面写'values'。 –