hmangla98 commented on code in PR #3293:
URL: https://github.com/apache/hive/pull/3293#discussion_r881227102


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/DumpMetaData.java:
##########
@@ -117,6 +153,32 @@ private void readReplScope(String line) throws IOException 
{
   }
 
   private void loadDumpFromFile() throws SemanticException {
+    boolean isInJSONFormat = resolveDumpFilePathAndGetIfV2();
+    if (isInJSONFormat) {
+      loadDumpFromFileV2();
+    } else {
+      loadDumpFromFileV1();
+    }
+  }
+
+  //Returns true if dumpmetaData is in V2 Format
+  private boolean resolveDumpFilePathAndGetIfV2() throws SemanticException {
+    if (isTopLevel) {
+      dumpFile = new Path(dumpRoot, DUMP_METADATA_V2);
+      if (Utils.fileExists(dumpFile, hiveConf)) {
+        return true;
+      }
+      //Backward-compatibility: fall back to old version. Dump might be 
generated by old version
+      dumpFile = new Path(dumpRoot, DUMP_METADATA);
+      LOG.info("Falling back to old version of dump meta data {}", dumpFile);
+    } else {
+      // The nested level _dumpmetadata file content is still in old format: 
To save JSON parsing cost.
+      dumpFile = new Path(dumpRoot, DUMP_METADATA);
+    }
+    return false;
+  }
+
+  private void loadDumpFromFileV1() throws SemanticException {
     BufferedReader br = null;
     try {

Review Comment:
   Added one. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to