zhangbutao commented on code in PR #6379:
URL: https://github.com/apache/hive/pull/6379#discussion_r3189474302


##########
ql/src/java/org/apache/hadoop/hive/llap/LlapHiveUtils.java:
##########
@@ -74,18 +75,21 @@ public static PartitionDesc partitionDescForPath(Path path, 
Map<Path, PartitionD
     return part;
   }
 
-  public static CacheTag getDbAndTableNameForMetrics(Path path, boolean 
includeParts,
-      PartitionDesc part) {
-
-    // Fallback to legacy cache tag creation logic.
+  /**
+   * Builds a {@link CacheTag} for the given path and partition descriptor.
+   * The catalog name is derived from the {@link PartitionDesc} when 
available, falling back
+   * to {@link Warehouse#DEFAULT_CATALOG_NAME} when {@code part} is null.
+   */
+  public static CacheTag getCacheTag(Path path, boolean includeParts, 
PartitionDesc part) {
     if (part == null) {
-      return CacheTag.build(LlapUtil.getDbAndTableNameForMetrics(path, 
includeParts));
+      return CacheTag.build(
+          Warehouse.DEFAULT_CATALOG_NAME, 
LlapUtil.getDbAndTableNameForMetrics(path, includeParts));

Review Comment:
   > We do but what if the current session's catalog is say catalog1 but the 
eviction request is sent out for an unpartitioned table say unpartitionedtable1 
which belongs to catalog2. If we use `SessionState.get().getCurrentCatalog()` 
won't the cachetag be returned as `catalog1.db1.unpartitionedtable1` instead of 
`catalog2.db1.unpartitionedtable1` ?
   
   @Neer393 You are correct. If an SQL query contains a table with a catalog 
name, such as `catalog2.db1.unpartitionedtable1`, the query should use 
`catalog2` rather than the current session's `catalog1`.
   
   It seems that `LlapUtil::getDbAndTableNameForMetrics` can infer the database 
name and table name. I'm wondering whether it might also be able to infer the 
catalog name in this case?



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