Sqoop
  1. Sqoop
  2. SQOOP-862

Hbase import fails if there is a row where all columns are null

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.3
    • Component/s: None
    • Labels:
      None

      Description

      If you try to import a table where any of the rows contain all null values (except for the primary key), the import fails. For example create the following table in Oracle:

      CREATE TABLE employee(id number primary key, test_number number);
      INSERT INTO employee values(1, 123);
      INSERT INTO employee values(2, null);
      COMMIT;

      Then run an import:

      sqoop import --connect jdbc:oracle:thin:@//HOSTNAME/SERVICE --username USERNAME --table EMPLOYEE --password PASSWORD --hbase-table EMPLOYEE --column-family tst --hbase-create-table

      The Import fails with:

      java.lang.IllegalArgumentException: No columns to insert
      at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:400)
      Caused by: java.lang.IllegalArgumentException: No columns to insert
      at org.apache.hadoop.hbase.client.HTable.validatePut(HTable.java:950)
      at org.apache.hadoop.hbase.client.HTable.doPut(HTable.java:766)
      at org.apache.hadoop.hbase.client.HTable.put(HTable.java:752)
      at org.apache.sqoop.hbase.HBasePutProcessor.accept(HBasePutProcessor.java:127)
      at org.apache.sqoop.mapreduce.DelegatingOutputFormat$DelegatingRecordWriter.write(DelegatingOutputFormat.java:128)
      at org.apache.sqoop.mapreduce.DelegatingOutputFormat$DelegatingRecordWriter.write(DelegatingOutputFormat.java:1)
      at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write(MapTask.java:598)
      at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)
      at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(WrappedMapper.java:112)
      at org.apache.sqoop.mapreduce.HBaseImportMapper.map(HBaseImportMapper.java:38)
      at org.apache.sqoop.mapreduce.HBaseImportMapper.map(HBaseImportMapper.java:1)
      at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
      at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
      at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:725)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332)
      at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:232)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      1. SQOOP-862.patch
        4 kB
        David Robson
      2. SQOOP-862.patch
        4 kB
        David Robson

        Issue Links

          Activity

          Hide
          David Robson added a comment -

          Added defensive code to skip the HBase put and warn the user if it has no columns and would therefore fail.
          Added a new unit test for this issue.

          Show
          David Robson added a comment - Added defensive code to skip the HBase put and warn the user if it has no columns and would therefore fail. Added a new unit test for this issue.
          Hide
          David Robson added a comment -

          Updated patch with documentation changes.

          Show
          David Robson added a comment - Updated patch with documentation changes.
          Hide
          Jarek Jarcec Cecho added a comment -
          Show
          Jarek Jarcec Cecho added a comment - The patch is in: https://git-wip-us.apache.org/repos/asf?p=sqoop.git;a=commit;h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db Thank you David for your contribution! Jarcec
          Hide
          Hudson added a comment -

          Integrated in Sqoop-ant-jdk-1.6-hadoop20 #553 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop20/553/)
          SQOOP-862: Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db)

          Result = SUCCESS
          jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db
          Files :

          • src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          • src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java
          • src/docs/user/hbase.txt
          • src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
          Show
          Hudson added a comment - Integrated in Sqoop-ant-jdk-1.6-hadoop20 #553 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop20/553/ ) SQOOP-862 : Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db) Result = SUCCESS jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db Files : src/java/org/apache/sqoop/hbase/HBasePutProcessor.java src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java src/docs/user/hbase.txt src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
          Hide
          Hudson added a comment -

          Integrated in Sqoop-ant-jdk-1.6-hadoop200 #551 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop200/551/)
          SQOOP-862: Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db)

          Result = SUCCESS
          jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db
          Files :

          • src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java
          • src/docs/user/hbase.txt
          • src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
          • src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          Show
          Hudson added a comment - Integrated in Sqoop-ant-jdk-1.6-hadoop200 #551 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop200/551/ ) SQOOP-862 : Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db) Result = SUCCESS jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db Files : src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java src/docs/user/hbase.txt src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          Hide
          Hudson added a comment -

          Integrated in Sqoop-ant-jdk-1.6-hadoop23 #747 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop23/747/)
          SQOOP-862: Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db)

          Result = SUCCESS
          jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db
          Files :

          • src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java
          • src/docs/user/hbase.txt
          • src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
          • src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          Show
          Hudson added a comment - Integrated in Sqoop-ant-jdk-1.6-hadoop23 #747 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop23/747/ ) SQOOP-862 : Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db) Result = SUCCESS jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db Files : src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java src/docs/user/hbase.txt src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          Hide
          Hudson added a comment -

          Integrated in Sqoop-ant-jdk-1.6-hadoop100 #549 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop100/549/)
          SQOOP-862: Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db)

          Result = SUCCESS
          jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db
          Files :

          • src/docs/user/hbase.txt
          • src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java
          • src/java/org/apache/sqoop/hbase/HBasePutProcessor.java
          • src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
          Show
          Hudson added a comment - Integrated in Sqoop-ant-jdk-1.6-hadoop100 #549 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6-hadoop100/549/ ) SQOOP-862 : Hbase import fails if there is a row where all columns are null (Revision 20b16fd4bd0b045a11006d81ddd1bcc8bccd01db) Result = SUCCESS jarcec : https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=20b16fd4bd0b045a11006d81ddd1bcc8bccd01db Files : src/docs/user/hbase.txt src/test/com/cloudera/sqoop/hbase/HBaseTestCase.java src/java/org/apache/sqoop/hbase/HBasePutProcessor.java src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java

            People

            • Assignee:
              David Robson
              Reporter:
              David Robson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development