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


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/lock/show/ShowLocksAnalyzer.java:
##########
@@ -44,29 +48,56 @@ public ShowLocksAnalyzer(QueryState queryState) throws 
SemanticException {
   public void analyzeInternal(ASTNode root) throws SemanticException {
     ctx.setResFile(ctx.getLocalTmpPath());
 
-    String tableName = null;
+    String fullyQualifiedTableName = null;
     Map<String, String> partitionSpec = null;
     boolean isExtended = false;
     if (root.getChildCount() >= 1) {
       // table for which show locks is being executed
       for (int i = 0; i < root.getChildCount(); i++) {
         ASTNode child = (ASTNode) root.getChild(i);
         if (child.getType() == HiveParser.TOK_TABTYPE) {
-          tableName = DDLUtils.getFQName((ASTNode) child.getChild(0));
+          fullyQualifiedTableName = DDLUtils.getFQName((ASTNode) 
child.getChild(0));
           // get partition metadata if partition specified
           if (child.getChildCount() == 2) {
             ASTNode partitionSpecNode = (ASTNode) child.getChild(1);
-            partitionSpec = getValidatedPartSpec(getTable(tableName), 
partitionSpecNode, conf, false);
+            partitionSpec = 
getValidatedPartSpec(getTable(fullyQualifiedTableName), partitionSpecNode, 
conf, false);
           }
         } else if (child.getType() == HiveParser.KW_EXTENDED) {
           isExtended = true;
         }
       }
     }
 
+    String catalogName = null;
+    String dbName = null;
+    String tableName = null;
+
+    if (fullyQualifiedTableName != null) {
+      List<String> splitFullyQualifiedTableName = 
Arrays.stream(fullyQualifiedTableName.split("\\.")).toList();
+      if (splitFullyQualifiedTableName.size() == 1) {
+        catalogName = SessionState.get().getCurrentCatalog();
+        dbName = SessionState.get().getCurrentDatabase();
+        tableName = splitFullyQualifiedTableName.get(0);
+      } else if (splitFullyQualifiedTableName.size() == 2) {
+        catalogName = SessionState.get().getCurrentCatalog();
+        dbName = splitFullyQualifiedTableName.get(0);
+        tableName = splitFullyQualifiedTableName.get(1);
+      } else {
+        catalogName = splitFullyQualifiedTableName.get(0);
+        dbName = splitFullyQualifiedTableName.get(1);
+        tableName = splitFullyQualifiedTableName.get(2);
+      }

Review Comment:
   @zhangbutao is this comment correct ? Can identifiers have '.' in them ?



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