You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Ashish Singhi (JIRA)" <ji...@apache.org> on 2017/02/24 05:03:44 UTC

[jira] [Resolved] (HBASE-17687) hive on hbase table and phoenix table can't be selected

     [ https://issues.apache.org/jira/browse/HBASE-17687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Singhi resolved HBASE-17687.
-----------------------------------
      Resolution: Invalid
    Hadoop Flags:   (was: Incompatible change)

> hive on hbase table and phoenix table can't  be selected
> --------------------------------------------------------
>
>                 Key: HBASE-17687
>                 URL: https://issues.apache.org/jira/browse/HBASE-17687
>             Project: HBase
>          Issue Type: Improvement
>          Components: hbase
>    Affects Versions: 1.0.2
>         Environment: hadoop 2.7.2
> hbase 1.0.2
> phoenix 4.4
> hive 1.3
> all above are based on huawei FusionInsight HD(FusionInsight V100R002C60U10SPC001)
>            Reporter: yunliangchen
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> First , I created a table on phoenix, as this:
> ---------------------------------------------------------------------------
> DROP TABLE IF EXISTS bidwd_test01 CASCADE;
> CREATE TABLE IF NOT EXISTS bidwd_test01(
>    rk VARCHAR,
>    c1 integer,
>    c2 VARCHAR,
>    c3 VARCHAR,
>    c4 VARCHAR
>    constraint bidwd_test01_pk primary key(rk)
> )
> COMPRESSION='SNAPPY'
> ;
> ---------------------------------------------------------------------------
> And then , I upserted two rows into the table:
> ---------------------------------------------------------------------------
> upsert into bidwd_test01 values('001',1,'zhangsan','20170217','2017-02-17 12:34:22');
> upsert into bidwd_test01 values('002',2,'lisi','20170216','2017-02-16 12:34:22');
> ---------------------------------------------------------------------------
> At last , I scaned the table like this:
> ---------------------------------------------------------------------------
> select * from bidwd_test01;
> ---------------------------------------------------------------------------
> It's OK by now, but, I want to create a hive on hbase table ,that mapping to the phoenix table , the script likes this:
> ---------------------------------------------------------------------------
> USE BIDWD;
> DROP TABLE test01;
> CREATE EXTERNAL TABLE test01
> (
>  rk string,
>  id int,
>  name string,
>  datekey string,
>  time_stamp string
> )
> STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  
> WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,0:C1,0:C2,0:C3,0:C4")  
> TBLPROPERTIES ("hbase.table.name" = "BIDWD_TEST01");
> ---------------------------------------------------------------------------
> So,I also try to insert some data into the table,and scan this table:
> ---------------------------------------------------------------------------
> set hive.execution.engine=mr;
> insert into test01 values('003',3,'lisi2','20170215','2017-02-15 12:34:22');
> select * from test01;
> ---------------------------------------------------------------------------
> But,there are some problems like this:
> +------------+------------+--------------+-----------------+----------------------+--+
> | test01.rk  | test01.id  | test01.name  | test01.datekey  |  test01.time_stamp   |
> +------------+------------+--------------+-----------------+----------------------+--+
> | 001        | NULL       | zhangsan     | 20170217        | 2017-02-17 12:34:22  |
> | 002        | NULL       | lisi         | 20170216        | 2017-02-16 12:34:22  |
> | 003        | 3          | lisi2        | 20170215        | 2017-02-15 12:34:22  |
> +------------+------------+--------------+-----------------+----------------------+--+
> the column "id" 's value was null,only the last row is ok.
> but,when I scan data in the phoenix ,there are some errors like this:
> Error: ERROR 201 (22000): Illegal data. Expected length of at least 115 bytes, but had 31 (state=22000,code=201)
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 115 bytes, but had 31
> 	at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:389)
> 	at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
> 	at org.apache.phoenix.schema.KeyValueSchema.next(KeyValueSchema.java:211)
> 	at org.apache.phoenix.expression.ProjectedColumnExpression.evaluate(ProjectedColumnExpression.java:113)
> 	at org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:69)
> 	at org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:591)
> 	at sqlline.Rows$Row.<init>(Rows.java:183)
> 	at sqlline.BufferedRows.<init>(BufferedRows.java:38)
> 	at sqlline.SqlLine.print(SqlLine.java:1546)
> 	at sqlline.Commands.execute(Commands.java:833)
> 	at sqlline.Commands.sql(Commands.java:732)
> 	at sqlline.SqlLine.dispatch(SqlLine.java:702)
> 	at sqlline.SqlLine.begin(SqlLine.java:575)
> 	at sqlline.SqlLine.start(SqlLine.java:292)
> 	at sqlline.SqlLine.main(SqlLine.java:194)
> So,I don't know why? How can I solve this problem?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)