Review Board 1.7.22


Fix Sqoop unit test failures on Windows

Review Request #10229 - Created April 1, 2013 and updated

Ahmed El Baz
trunk
SQOOP-955
Reviewers
Sqoop
sqoop-trunk
Please see SQOOP-955 for details

 
src/java/org/apache/sqoop/hive/HiveImport.java
Revision ce34286 New Change
[20] 32 lines
[+20]
33
import org.apache.hadoop.fs.FileStatus;
33
import org.apache.hadoop.fs.FileStatus;
34
import org.apache.hadoop.fs.FileSystem;
34
import org.apache.hadoop.fs.FileSystem;
35
import org.apache.hadoop.fs.Path;
35
import org.apache.hadoop.fs.Path;
36
import org.apache.hadoop.conf.Configuration;
36
import org.apache.hadoop.conf.Configuration;
37
import org.apache.hadoop.util.ReflectionUtils;
37
import org.apache.hadoop.util.ReflectionUtils;

    
   
38
import org.apache.hadoop.util.Shell;
38
import org.apache.hadoop.util.ToolRunner;
39
import org.apache.hadoop.util.ToolRunner;
39
import org.apache.hadoop.util.Tool;
40
import org.apache.hadoop.util.Tool;
40
import org.apache.sqoop.io.CodecMap;
41
import org.apache.sqoop.io.CodecMap;
41
import org.apache.sqoop.util.Executor;
42
import org.apache.sqoop.util.Executor;
42
import org.apache.sqoop.util.LoggingAsyncSink;
43
import org.apache.sqoop.util.LoggingAsyncSink;
[+20] [20] 37 lines
[+20] [+] public class HiveImport {
80
    // If the user has $HIVE_HOME set, then use $HIVE_HOME/bin/hive if it
81
    // If the user has $HIVE_HOME set, then use $HIVE_HOME/bin/hive if it
81
    // exists.
82
    // exists.
82
    // Fall back to just plain 'hive' and hope it's in the path.
83
    // Fall back to just plain 'hive' and hope it's in the path.
83

    
   
84

   
84
    String hiveHome = options.getHiveHome();
85
    String hiveHome = options.getHiveHome();

    
   
86
    String hiveCommand = Shell.WINDOWS ? "hive.cmd" : "hive";
85
    if (null == hiveHome) {
87
    if (null == hiveHome) {
86
      return "hive";
88
      return hiveCommand;
87
    }
89
    }
88

    
   
90

   
89
    Path p = new Path(hiveHome);
91
    Path p = new Path(hiveHome);
90
    p = new Path(p, "bin");
92
    p = new Path(p, "bin");
91
    p = new Path(p, "hive");
93
    p = new Path(p, hiveCommand);
92
    String hiveBinStr = p.toString();
94
    String hiveBinStr = p.toString();
93
    if (new File(hiveBinStr).exists()) {
95
    if (new File(hiveBinStr).exists()) {
94
      return hiveBinStr;
96
      return hiveBinStr;
95
    } else {
97
    } else {
96
      return "hive";
98
      return hiveCommand;
97
    }
99
    }
98
  }
100
  }
99

    
   
101

   
100
  /**
102
  /**
101
   * If we used a MapReduce-based upload of the data, remove the _logs dir
103
   * If we used a MapReduce-based upload of the data, remove the _logs dir
[+20] [20] 267 lines
src/java/org/apache/sqoop/orm/CompilationManager.java
Revision 92effb5 New Change
 
src/java/org/apache/sqoop/util/ClassLoaderStack.java
Revision 8e41cb3 New Change
 
src/test/com/cloudera/sqoop/hive/TestHiveImport.java
Revision 170bc66 New Change
 
src/test/com/cloudera/sqoop/io/TestNamedFifo.java
Revision 9f0a585 New Change
 
src/test/com/cloudera/sqoop/lib/TestBlobRef.java
Revision 2054a9b New Change
 
src/test/com/cloudera/sqoop/lib/TestClobRef.java
Revision 8cb05e9 New Change
 
src/test/com/cloudera/sqoop/orm/TestClassWriter.java
Revision 3b77571 New Change
 
testdata/hive/bin/hive.cmd
New File
 
  1. src/java/org/apache/sqoop/hive/HiveImport.java: Loading...
  2. src/java/org/apache/sqoop/orm/CompilationManager.java: Loading...
  3. src/java/org/apache/sqoop/util/ClassLoaderStack.java: Loading...
  4. src/test/com/cloudera/sqoop/hive/TestHiveImport.java: Loading...
  5. src/test/com/cloudera/sqoop/io/TestNamedFifo.java: Loading...
  6. src/test/com/cloudera/sqoop/lib/TestBlobRef.java: Loading...
  7. src/test/com/cloudera/sqoop/lib/TestClobRef.java: Loading...
  8. src/test/com/cloudera/sqoop/orm/TestClassWriter.java: Loading...
  9. testdata/hive/bin/hive.cmd: Loading...