Shengjie
Shengjie

Reputation: 12786

sqoop free form query import to HBase not working

I've got sqoop table import to HBase working as below:

sqoop import --connect jdbc:mysql://${mysql-server-address}/test -username root -password admin --table Student --hbase-create-table --hbase-table student --column-family i

Next step, I am trying to get free form query working as well, someow, the sqoop command below I tried doesn't work as expected, nothing has been imported from source table to the target HBase table.

sqoop import --connect jdbc:mysql://${mysql-server-address}/test -username root -password admin --query 'SELECT id, name from Student where $CONDITIONS' --split-by Student.id --hbase-create-table --hbase-table student --column-family i

Is there anything I am missing from the 2nd sqoop command? The document is very limited in terms of HBase import.

here is the log from command 2 if it helps:

13/08/06 21:15:43 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(t1.id), MAX(t1.id) FROM (SELECT * from Student where  (1 = 1) ) AS t1
13/08/06 21:15:46 INFO mapred.JobClient: Running job: job_201308061021_0025
13/08/06 21:15:47 INFO mapred.JobClient:  map 0% reduce 0%
13/08/06 21:19:08 INFO mapred.JobClient:  map 75% reduce 0%
13/08/06 21:19:09 INFO mapred.JobClient:  map 100% reduce 0%
13/08/06 21:19:12 INFO mapred.JobClient: Job complete: job_201308061021_0025
13/08/06 21:19:12 INFO mapred.JobClient: Counters: 17
13/08/06 21:19:12 INFO mapred.JobClient:   Job Counters
13/08/06 21:19:12 INFO mapred.JobClient:     SLOTS_MILLIS_MAPS=212866
13/08/06 21:19:12 INFO mapred.JobClient:     Total time spent by all reduces waiting after reserving slots (ms)=0
13/08/06 21:19:13 INFO mapred.JobClient:     Total time spent by all maps waiting after reserving slots (ms)=0
13/08/06 21:19:13 INFO mapred.JobClient:     Launched map tasks=4
13/08/06 21:19:13 INFO mapred.JobClient:     SLOTS_MILLIS_REDUCES=0
13/08/06 21:19:13 INFO mapred.JobClient:   File Output Format Counters
13/08/06 21:19:13 INFO mapred.JobClient:     Bytes Written=0
13/08/06 21:19:13 INFO mapred.JobClient:   FileSystemCounters
13/08/06 21:19:13 INFO mapred.JobClient:     HDFS_BYTES_READ=441
13/08/06 21:19:13 INFO mapred.JobClient:     FILE_BYTES_WRITTEN=362752
13/08/06 21:19:13 INFO mapred.JobClient:   File Input Format Counters
13/08/06 21:19:13 INFO mapred.JobClient:     Bytes Read=0
13/08/06 21:19:13 INFO mapred.JobClient:   Map-Reduce Framework
13/08/06 21:19:13 INFO mapred.JobClient:     Map input records=4
13/08/06 21:19:13 INFO mapred.JobClient:     Physical memory (bytes) snapshot=428892160
13/08/06 21:19:13 INFO mapred.JobClient:     Spilled Records=0
13/08/06 21:19:13 INFO mapred.JobClient:     CPU time spent (ms)=7730
13/08/06 21:19:13 INFO mapred.JobClient:     Total committed heap usage (bytes)=312672256
13/08/06 21:19:13 INFO mapred.JobClient:     Virtual memory (bytes) snapshot=5353742336
13/08/06 21:19:13 INFO mapred.JobClient:     Map output records=4
13/08/06 21:19:13 INFO mapred.JobClient:     SPLIT_RAW_BYTES=441
13/08/06 21:19:13 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 213.1239 seconds (0 bytes/sec)
13/08/06 21:19:13 INFO mapreduce.ImportJobBase: Retrieved 4 records.

Upvotes: 1

Views: 991

Answers (1)

Martias
Martias

Reputation: 171

--split-by Student.id should be --split-by id

Upvotes: 1

Related Questions