Review Board 1.7.22


In-process Hive CLI driver does not work

Review Request #7143 - Created Sept. 18, 2012 and submitted

David Robson
trunk
SQOOP-607
Reviewers
Sqoop
sqoop-trunk
Throw the exception from the old namespace to support anyone checking the old exception. Also update HiveImport to check the new namespace.
Created a mock Hive CLI that calls System.exit(0). Can see it now works.
Was trying to create an automated test but the problem was once I created the mock class it was used for the other tests as well instead of the shell script.
The easiest way I can see to create a unit test would be to allow the Hive CLI class to be specified as a parameter - that way it could be overridden in a unit test to a mock class.
Was also thinking about loading the class at runtime but this seemed like a bit of work for a small bug fix.

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

1 2
1 2

  1. src/java/org/apache/sqoop/hive/HiveImport.java: Loading...
  2. src/java/org/apache/sqoop/util/SubprocessSecurityManager.java: Loading...
src/java/org/apache/sqoop/hive/HiveImport.java
Revision ce34286 New Change
[20] 36 lines
[+20]
37
import org.apache.hadoop.util.ReflectionUtils;
37
import org.apache.hadoop.util.ReflectionUtils;
38
import org.apache.hadoop.util.ToolRunner;
38
import org.apache.hadoop.util.ToolRunner;
39
import org.apache.hadoop.util.Tool;
39
import org.apache.hadoop.util.Tool;
40
import org.apache.sqoop.io.CodecMap;
40
import org.apache.sqoop.io.CodecMap;
41
import org.apache.sqoop.util.Executor;
41
import org.apache.sqoop.util.Executor;

    
   
42
import org.apache.sqoop.util.ExitSecurityException;
42
import org.apache.sqoop.util.LoggingAsyncSink;
43
import org.apache.sqoop.util.LoggingAsyncSink;
43
import org.apache.sqoop.util.SubprocessSecurityManager;
44
import org.apache.sqoop.util.SubprocessSecurityManager;
44

    
   
45

   
45
import com.cloudera.sqoop.SqoopOptions;
46
import com.cloudera.sqoop.SqoopOptions;
46
import com.cloudera.sqoop.manager.ConnManager;
47
import com.cloudera.sqoop.manager.ConnManager;
47
import com.cloudera.sqoop.util.ExitSecurityException;

   
48

    
   
48

   
49
/**
49
/**
50
 * Utility to import a table into the Hive metastore. Manages the connection
50
 * Utility to import a table into the Hive metastore. Manages the connection
51
 * to Hive itself as well as orchestrating the use of the other classes in this
51
 * to Hive itself as well as orchestrating the use of the other classes in this
52
 * package.
52
 * package.
[+20] [20] 316 lines
src/java/org/apache/sqoop/util/SubprocessSecurityManager.java
Revision 4951627 New Change
 
  1. src/java/org/apache/sqoop/hive/HiveImport.java: Loading...
  2. src/java/org/apache/sqoop/util/SubprocessSecurityManager.java: Loading...