You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2019/03/11 14:14:52 UTC

[hive] branch master updated: HIVE-21412 : PostExecOrcFileDump doesn't work with ACID tables (Denys Kuzmenko via Ashutosh Chauhan)

This is an automated email from the ASF dual-hosted git repository.

hashutosh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ad159e2  HIVE-21412 : PostExecOrcFileDump doesn't work with ACID tables (Denys Kuzmenko via Ashutosh Chauhan)
ad159e2 is described below

commit ad159e25386cc597ea284913e50319795e665424
Author: denys kuzmenko <dk...@cloudera.com>
AuthorDate: Mon Mar 11 07:14:05 2019 -0700

    HIVE-21412 : PostExecOrcFileDump doesn't work with ACID tables (Denys Kuzmenko via Ashutosh Chauhan)
    
    Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
---
 .../hadoop/hive/ql/hooks/PostExecOrcFileDump.java  | 54 +++++++++++++---------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/PostExecOrcFileDump.java b/ql/src/java/org/apache/hadoop/hive/ql/hooks/PostExecOrcFileDump.java
index df99674..87c3db2 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/PostExecOrcFileDump.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/PostExecOrcFileDump.java
@@ -88,28 +88,7 @@ public class PostExecOrcFileDump implements ExecuteWithHookContext {
       }
 
       for (Path dir : directories) {
-        FileSystem fs = dir.getFileSystem(conf);
-        List<FileStatus> fileList = HdfsUtils.listLocatedStatus(fs, dir,
-            hiddenFileFilter);
-
-        for (FileStatus fileStatus : fileList) {
-          LOG.info("Printing orc file dump for " + fileStatus.getPath());
-          if (fileStatus.getLen() > 0) {
-            try {
-              // just creating orc reader is going to do sanity checks to make sure its valid ORC file
-              OrcFile.createReader(fs, fileStatus.getPath());
-              console.printError("-- BEGIN ORC FILE DUMP --");
-              FileDump.main(new String[]{fileStatus.getPath().toString(), "--rowindex=*"});
-              console.printError("-- END ORC FILE DUMP --");
-            } catch (FileFormatException e) {
-              LOG.warn("File " + fileStatus.getPath() + " is not ORC. Skip printing orc file dump");
-            } catch (IOException e) {
-              LOG.warn("Skip printing orc file dump. Exception: " + e.getMessage());
-            }
-          } else {
-            LOG.warn("Zero length file encountered. Skip printing orc file dump.");
-          }
-        }
+        printFileStatus(console, dir.getFileSystem(conf), dir);
       }
 
       // restore the old out stream
@@ -118,4 +97,35 @@ public class PostExecOrcFileDump implements ExecuteWithHookContext {
     }
   }
 
+  private void printFileStatus(SessionState.LogHelper console, FileSystem fs, Path dir) throws Exception {
+    List<FileStatus> fileList = HdfsUtils.listLocatedStatus(fs, dir,
+        hiddenFileFilter);
+
+    for (FileStatus fileStatus : fileList) {
+      if (fileStatus.isDirectory()) {
+
+        // delta directory in case of ACID
+        printFileStatus(console, fs, fileStatus.getPath());
+      } else {
+
+        LOG.info("Printing orc file dump for " + fileStatus.getPath());
+        if (fileStatus.getLen() > 0) {
+          try {
+            // just creating orc reader is going to do sanity checks to make sure its valid ORC file
+            OrcFile.createReader(fs, fileStatus.getPath());
+            console.printError("-- BEGIN ORC FILE DUMP --");
+            FileDump.main(new String[]{fileStatus.getPath().toString(), "--rowindex=*"});
+            console.printError("-- END ORC FILE DUMP --");
+          } catch (FileFormatException e) {
+            LOG.warn("File " + fileStatus.getPath() + " is not ORC. Skip printing orc file dump");
+          } catch (IOException e) {
+            LOG.warn("Skip printing orc file dump. Exception: " + e.getMessage());
+          }
+        } else {
+          LOG.warn("Zero length file encountered. Skip printing orc file dump.");
+        }
+      }
+    }
+  }
+
 }