0
votes

I am using the following Linux command:

hadoop jar phoenix-4.6.0-HBase-0.98-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool --table TT --input /tmp/text.csv 

This command works successfully, but no data from csv file is loaded in hbase table, but data is loaded to the index table successfully (import csv file for TT's index table).

environment:

HBASE 0.98.9

hadoop 2.6.0

Phoenix 4.6-hbase-0.98

case 1:index covered all columns

1)

CREATE TABLE example (
    my_pk bigint not null,
    m.first_name varchar(50),
    m.last_name varchar(50)
    CONSTRAINT pk PRIMARY KEY (my_pk))

2)

CREATE INDEX index_example on example(m.last_name ASC) include (m.first_name)
   or create index index_example on example(m.first_name,m.last_name)

3)

hadoop jar phoenix-4.6.0-HBase-0.98-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool --table example --input /tmp/text1.csv --index-table INDEX_EXAMPLE

4)

select * from example

SUCCESS AND HAVE DATA

select * from index_example

SUCCESS AND HAVE DATA

testcase: org.apache.phoenix.mapreduce.CsvBulkLoadToolIT.testImportWithIndex()

case 2:index covered part of columns

1)

CREATE TABLE example (
    my_pk bigint not null,
    m.first_name varchar(50),
    m.last_name varchar(50)
    CONSTRAINT pk PRIMARY KEY (my_pk))

2)

create index index_example on example(m.last_name ASC)

3)

hadoop jar phoenix-4.6.0-HBase-0.98-client.jar 
org.apache.phoenix.mapreduce.CsvBulkLoadTool --table example --input /tmp/text1.csv --index-table INDEX_EXAMPLE

4)

select * from example

SUCCESS BUT NO DATA

select * from index_example

SUCCESS HAVE DATA

testcase: org.apache.phoenix.mapreduce.CsvBulkLoadToolIT.testImportOneIndexTable()

1
Can you post the queries that you create the table and its index? Also a sample data in your csv file. - Afshin Moazami
CSV file like this: 12345,John,Doe - paul
You can simply edit your question and post them there. - Afshin Moazami
Are you sure there is no data? Did you try to scan the tables in hbase? Maybe the query is using the table/index that you don't expect. - Afshin Moazami
I have edited my question。I`m sure there is no data,I checked the hbase table. - paul

1 Answers

1
votes

This is a known bug in Phoenix, when your table name is in lowercase. You need to cover them with double quotes

    hadoop jar phoenix-4.6.0-HBase-0.98-client.jar 
org.apache.phoenix.mapreduce.CsvBulkLoadTool --table \"\"example\"\" --input /tmp/text1.csv --index-table INDEX_EXAMPLE