hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zs...@apache.org
Subject svn commit: r697295 - /hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
Date Sat, 20 Sep 2008 00:16:13 GMT
Author: zshao
Date: Fri Sep 19 17:16:13 2008
New Revision: 697295

URL: http://svn.apache.org/viewvc?rev=697295&view=rev
Log:
HADOOP-4205. Reverted to 697291 because of an erroneous commit of this file.

Modified:
    hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java

Modified: hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java?rev=697295&r1=697294&r2=697295&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
(original)
+++ hadoop/core/trunk/src/contrib/hive/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
Fri Sep 19 17:16:13 2008
@@ -82,30 +82,27 @@
         e.printStackTrace();
       }
 
-    } else {
+    } 
+    else {
       ret = qp.run(cmd);
       Vector<Vector<String>> res = new Vector<Vector<String>>();
-      while (qp.getResults(res))
-      {
-        SessionState ss = SessionState.get();
-        OutputStream out = ss.out;
-        try 
-        {
+      while (qp.getResults(res)) {
+        SessionState ss  = SessionState.get();
+        PrintStream out = ss.out;
 
-          for (Vector<String> row:res)
+        for (Vector<String> row:res)
+        {
+          boolean firstCol = true;
+          for (String col:row)
           {
-            for (String col:row)
-            {
-              out.write(col == null ? Utilities.nullStringOutput.getBytes() : col.getBytes());
+            if (!firstCol)
               out.write(Utilities.tabCode);
-            } 
-            out.write(Utilities.newLineCode);
-          }
-          res.clear();
-
-        } catch (IOException e) {
-          e.printStackTrace();
+            out.print(col == null ? Utilities.nullStringOutput : col);
+            firstCol = false;
+          } 
+          out.write(Utilities.newLineCode);
         }
+        res.clear();
       }
     }
     return ret;
@@ -151,16 +148,20 @@
     SessionState.initHiveLog4j();
 
     CliSessionState ss = new CliSessionState (new HiveConf(SessionState.class));
+    ss.in = System.in;
+    try {
+      ss.out = new PrintStream(System.out, true, "UTF-8");
+      ss.err = new PrintStream(System.err, true, "UTF-8");
+    } catch (UnsupportedEncodingException e) {
+      System.exit(3);
+    }
+
     SessionState.start(ss);
 
     if(! oproc.process_stage2(ss)) {
       System.exit(2);
     }
 
-    ss.in = System.in;
-    ss.out = System.out;
-    ss.err = System.err;
-
     sp = new SetProcessor();
     qp = new Driver();
 



Mime
View raw message