You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by nz...@apache.org on 2010/02/20 05:02:55 UTC

svn commit: r912074 - in /hadoop/hive/trunk: ./ ql/src/test/org/apache/hadoop/hive/ql/ ql/src/test/templates/

Author: nzhang
Date: Sat Feb 20 04:02:55 2010
New Revision: 912074

URL: http://svn.apache.org/viewvc?rev=912074&view=rev
Log:
HIVE-1182. Fix TestCliDriver too many open file error

Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java
    hadoop/hive/trunk/ql/src/test/templates/TestCliDriver.vm
    hadoop/hive/trunk/ql/src/test/templates/TestNegativeCliDriver.vm
    hadoop/hive/trunk/ql/src/test/templates/TestParse.vm
    hadoop/hive/trunk/ql/src/test/templates/TestParseNegative.vm

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Sat Feb 20 04:02:55 2010
@@ -30,8 +30,7 @@
     HIVE-1178. enforce bucketing for a table.
     (Namit Jain via He Yongqiang)
 
-  IMPROVEMENTS
-
+  IMPROVEMENTS 
     HIVE-983. Function from_unixtime takes long.
     (Ning Zhang via zshao)
 
@@ -95,6 +94,9 @@
 
     HIVE-1181. Make it optional to check file format. (Yongqiang He via zshao)
 
+    HIVE-1182. Fix TestCliDriver too many open file error.
+    (Zheng Shao via Ning Zhang)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java (original)
+++ hadoop/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java Sat Feb 20 04:02:55 2010
@@ -234,6 +234,8 @@
       qsb.append(dis.readLine() + "\n");
     }
     qMap.put(qf.getName(), qsb.toString());
+    
+    dis.close();
   }
 
   public void cleanUp() throws Exception {
@@ -469,6 +471,10 @@
     ss.out = new PrintStream(fo, true, "UTF-8");
     ss.err = ss.out;
     ss.setIsSilent(true);
+    SessionState oldSs = SessionState.get();
+    if (oldSs != null) {
+      oldSs.out.close();
+    }
     SessionState.start(ss);
     cliDriver = new CliDriver();
   }

Modified: hadoop/hive/trunk/ql/src/test/templates/TestCliDriver.vm
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/templates/TestCliDriver.vm?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/templates/TestCliDriver.vm (original)
+++ hadoop/hive/trunk/ql/src/test/templates/TestCliDriver.vm Sat Feb 20 04:02:55 2010
@@ -38,9 +38,6 @@
 
       qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()", miniMR);
 
-#foreach ($qf in $qfiles)
-      qt.addFile("$qf.getCanonicalPath()");
-#end
     }
     catch (Exception e) {
       System.out.println("Exception: " + e.getMessage());
@@ -81,6 +78,9 @@
   public void testCliDriver_$tname() throws Exception {
     try {
       System.out.println("Begin query: " + "$fname");
+
+      qt.addFile("$qf.getCanonicalPath()");
+
       qt.cliInit("$fname");
       int ecode = qt.executeClient("$fname");
       if (ecode != 0) {

Modified: hadoop/hive/trunk/ql/src/test/templates/TestNegativeCliDriver.vm
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/templates/TestNegativeCliDriver.vm?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/templates/TestNegativeCliDriver.vm (original)
+++ hadoop/hive/trunk/ql/src/test/templates/TestNegativeCliDriver.vm Sat Feb 20 04:02:55 2010
@@ -27,9 +27,6 @@
     try {
       qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()");
 
-#foreach ($qf in $qfiles)
-      qt.addFile("$qf.getCanonicalPath()");
-#end
     }
     catch (Throwable e) {
       e.printStackTrace();
@@ -56,6 +53,9 @@
   public void testNegativeCliDriver_$tname() throws Exception {
     try {
       System.out.println("Begin query: " + "$fname");
+
+      qt.addFile("$qf.getCanonicalPath()");
+
       qt.cliInit("$fname");
       int ecode = qt.executeClient("$fname");
       if (ecode == 0) {

Modified: hadoop/hive/trunk/ql/src/test/templates/TestParse.vm
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/templates/TestParse.vm?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/templates/TestParse.vm (original)
+++ hadoop/hive/trunk/ql/src/test/templates/TestParse.vm Sat Feb 20 04:02:55 2010
@@ -23,10 +23,6 @@
   protected void setUp() {
     try {
       qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()");
-
-#foreach ($qf in $qfiles)
-      qt.addFile("$qf.getCanonicalPath()");
-#end
     }
     catch (Exception e) {
       System.out.println("Exception: " + e.getMessage());
@@ -54,6 +50,9 @@
   public void testParse_$tname() throws Exception {
     try {
       System.out.println("Begin query: " + "$fname");
+
+      qt.addFile("$qf.getCanonicalPath()");
+
       qt.init("$fname");
       ASTNode tree = qt.parseQuery("$fname");
       int ecode = qt.checkParseResults("$fname", tree);

Modified: hadoop/hive/trunk/ql/src/test/templates/TestParseNegative.vm
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/templates/TestParseNegative.vm?rev=912074&r1=912073&r2=912074&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/templates/TestParseNegative.vm (original)
+++ hadoop/hive/trunk/ql/src/test/templates/TestParseNegative.vm Sat Feb 20 04:02:55 2010
@@ -23,10 +23,6 @@
   protected void setUp() {
     try {
       qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()");
-
-#foreach ($qf in $qfiles)
-      qt.addFile("$qf.getCanonicalPath()");
-#end
     }
     catch (Exception e) {
       System.out.println("Exception: " + e.getMessage());
@@ -54,6 +50,9 @@
   public void testParseNegative_$tname() throws Exception {
     try {
       System.out.println("Begin query: " + "$fname");
+
+      qt.addFile("$qf.getCanonicalPath()");
+
       qt.init("$fname");
       ASTNode tree = qt.parseQuery("$fname");
       List<Task<? extends Serializable>> tasks = qt.analyzeAST(tree);