abstractdog commented on code in PR #6675:
URL: https://github.com/apache/hive/pull/6675#discussion_r3925593291


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java:
##########
@@ -146,12 +146,18 @@ public void flattenUnionSubdirectories(Path sourcePath) 
throws HiveException {
           Path path = i.next().getPath();
           Path parent = path.getParent();
           if (parent.getName().startsWith(prefix)) {
-            // We do rename by including the name of parent directory into the 
filename so that there are no clashes
-            // when we move the files to the parent directory. Ex. 
HIVE_UNION_SUBDIR_1/000000_0 -> 1_000000_0
+            // Fold the subdir index into the filename so there are no clashes 
when the files
+            // are moved to the parent directory, and so that the resulting 
name still matches
+            // the "original data file" convention that both the ACID reader 
(AcidUtils.
+            // ORIGINAL_PATTERN_COPY) and the metastore's non-ACID→ACID 
validator (Transactional
+            // ValidationListener.ORIGINAL_PATTERN_COPY) recognize:
+            //   HIVE_UNION_SUBDIR_1/000000_0 -> 000000_0_copy_1
+            // See Utilities.COPY_KEYWORD.
             String parentOfParent = parent.getParent().toString();
             String parentNameSuffix = 
parent.getName().substring(prefix.length());
 
-            fs.rename(path, new Path(parentOfParent + "/" + parentNameSuffix + 
"_" + path.getName()));
+            fs.rename(path,
+                new Path(parentOfParent + "/" + path.getName() + 
Utilities.COPY_KEYWORD + parentNameSuffix));

Review Comment:
   very good catch, I had to redesign the logic used in movetask, addressed in: 
https://github.com/apache/hive/pull/6675/changes/100134a1517d5a5750f60f528d28b490d41b52c7



-- 
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