Neer393 commented on code in PR #6314:
URL: https://github.com/apache/hive/pull/6314#discussion_r2922123271


##########
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java:
##########
@@ -2929,6 +2931,7 @@ public static List<LockComponent> 
makeLockComponents(Set<WriteEntity> outputs, S
       Table t = null;
       switch (input.getType()) {
         case DATABASE:
+          
compBuilder.setCatName(Optional.ofNullable(input.getDatabase().getCatalogName()).orElse(currentCatalog));

Review Comment:
   This cannot be extracted to some common logic as depending upon the input 
object type whether it is a database, table or partition or a dummy partition, 
we need to differently get the catalogname. I tried 
`input.getCatalog().getName()` but it fails as input type is never a catalog so 
   for databases -> 
`Optional.ofNullable(input.getDatabase().getCatalogName()).orElse(currentCatalog)`
   for tables  -> 
`Optional.ofNullable(input.getTable().getCatName()).orElse(currentCatalog)`
   for partitions -> 
`Optional.ofNullable(input.getPartition().getTable().getCatName()).orElse(currentCatalog)`
   
   So even if we tried extracting it to a common method is not useful as we 
would anyway need to use switch statement in it which would be equivalent to 
what we have now



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