SourabhBadhya commented on code in PR #4520:
URL: https://github.com/apache/hive/pull/4520#discussion_r1293093870


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java:
##########
@@ -1309,6 +1312,22 @@ public static void 
createMRWorkForMergingFiles(FileSinkOperator fsInput,
     // 2. Constructing a conditional task consisting of a move task and a map 
reduce task
     //
     Path inputDirName = fsInputDesc.getMergeInputDirName();
+
+    // For external CTAS queries, there is an optimisation which avoids 
rename/copy of
+    // files from -tmp to -ext. In such cases, the input dir must be -tmp.
+    try {
+      if (fsInputDesc.getTable() != null) {
+        FileSystem fs = inputDirName.getFileSystem(conf);
+        if (fsInputDesc.isCTASorCM() && 
TableType.EXTERNAL_TABLE.equals(fsInputDesc.getTable().getTableType())
+            && BlobStorageUtils.isBlobStorageFileSystem(conf, fs)
+            && !Utilities.shouldAvoidRename(fsInputDesc, conf)) {
+          fsInputDesc.setChangeToTmpPath(true);

Review Comment:
   Done.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to