【问题标题】:Timestamp format for phoenix upsert into hbase?phoenix upsert到hbase的时间戳格式?
【发布时间】:2015-11-03 17:27:36
【问题描述】:

我正在为 phoenix 编写 upsert 脚本以在 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脚本的另一种形式是什么?

【问题讨论】:

    标签: hbase apache-zookeeper phoenix


    【解决方案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.
    

    【讨论】:

    • 还是不行。我的问题中有错字,我忘了在括号前写values
    猜你喜欢
    • 1970-01-01
    • 2020-01-20
    • 2021-10-03
    • 2017-06-17
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    • 2011-12-04
    • 1970-01-01
    相关资源
    最近更新 更多