diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java b/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java index 3fcf0dc064f26d5e85a3a035e4e0b3b29638768c..9e613227b91aec84e83f5b1c185e98ee80c978bb 100644 --- a/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java +++ b/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java @@ -283,8 +283,7 @@ protected Void performDataRead() throws IOException, InterruptedException { recordReaderTime(startTime); return null; } - counters.setDesc(QueryFragmentCounters.Desc.TABLE, - LlapHiveUtils.getDbAndTableNameForMetrics(split.getPath(), false, parts)); + counters.setDesc(QueryFragmentCounters.Desc.TABLE, cacheTag.getTableName()); counters.setDesc(QueryFragmentCounters.Desc.FILE, split.getPath() + (fileKey == null ? "" : " (" + fileKey + ")")); try { diff --git a/storage-api/src/java/org/apache/hadoop/hive/common/io/CacheTag.java b/storage-api/src/java/org/apache/hadoop/hive/common/io/CacheTag.java index 47730ccbe3ec9a1b123c53aef2253af88da10c66..a846ed6c92730a06ba9ef602307d154fc83d784d 100644 --- a/storage-api/src/java/org/apache/hadoop/hive/common/io/CacheTag.java +++ b/storage-api/src/java/org/apache/hadoop/hive/common/io/CacheTag.java @@ -79,19 +79,20 @@ public static final CacheTag build(String tableName, Map partDes throw new IllegalArgumentException(); } - LinkedList partDescList = new LinkedList<>(); + String[] partDescs = new String[partDescMap.size()]; + int i = 0; for (Map.Entry entry : partDescMap.entrySet()) { StringBuilder sb = new StringBuilder(); sb.append(entry.getKey()).append("=").append(entry.getValue()); - partDescList.add(sb.toString()); + partDescs[i++] = sb.toString(); } - if (partDescList.size() == 1) { - return new SinglePartitionCacheTag(tableName, partDescList.get(0)); + if (partDescs.length == 1) { + return new SinglePartitionCacheTag(tableName, partDescs[0]); } else { // In this case it must be >1 - return new MultiPartitionCacheTag(tableName, partDescList); + return new MultiPartitionCacheTag(tableName, partDescs); } } @@ -105,7 +106,7 @@ public static final CacheTag build(String tableName, LinkedList partDesc return new SinglePartitionCacheTag(tableName, partDescList.get(0)); } else { // In this case it must be >1 - return new MultiPartitionCacheTag(tableName, partDescList); + return new MultiPartitionCacheTag(tableName, partDescList.toArray(new String[]{})); } } @@ -121,13 +122,15 @@ public static final CacheTag createParentCacheTag(CacheTag tag) { if (tag instanceof MultiPartitionCacheTag) { MultiPartitionCacheTag multiPartitionCacheTag = (MultiPartitionCacheTag) tag; - if (multiPartitionCacheTag.partitionDesc.size() > 2) { - LinkedList subList = new LinkedList<>(multiPartitionCacheTag.partitionDesc); - subList.removeLast(); + if (multiPartitionCacheTag.partitionDesc.length > 2) { + String[] subList = new String[multiPartitionCacheTag.partitionDesc.length - 1]; + for (int i = 0; i < subList.length; ++i) { + subList[i] = multiPartitionCacheTag.partitionDesc[i]; + } return new MultiPartitionCacheTag(multiPartitionCacheTag.tableName, subList); } else { return new SinglePartitionCacheTag(multiPartitionCacheTag.tableName, - multiPartitionCacheTag.partitionDesc.get(0)); + multiPartitionCacheTag.partitionDesc[0]); } } @@ -234,13 +237,15 @@ public int hashCode() { */ public static final class MultiPartitionCacheTag extends PartitionCacheTag { - private final LinkedList partitionDesc; + private final String[] partitionDesc; - private MultiPartitionCacheTag(String tableName, LinkedList partitionDesc) { + private MultiPartitionCacheTag(String tableName, String[] partitionDesc) { super(tableName); - this.partitionDesc = partitionDesc; - if (this.partitionDesc != null && this.partitionDesc.size() > 1) { - this.partitionDesc.stream().forEach(p -> p.intern()); + if (partitionDesc != null && partitionDesc.length > 1) { + for (int i = 0; i < partitionDesc.length; ++i) { + partitionDesc[i] = partitionDesc[i].intern(); + } + this.partitionDesc = partitionDesc; } else { throw new IllegalArgumentException(); } @@ -259,12 +264,12 @@ public int compareTo(CacheTag o) { if (tableNameDiff != 0) { return tableNameDiff; } else { - int sizeDiff = partitionDesc.size() - other.partitionDesc.size(); + int sizeDiff = partitionDesc.length - other.partitionDesc.length; if (sizeDiff != 0) { return sizeDiff; } else { - for (int i = 0; i < partitionDesc.size(); ++i) { - int partDiff = partitionDesc.get(i).compareTo(other.partitionDesc.get(i)); + for (int i = 0; i < partitionDesc.length; ++i) { + int partDiff = partitionDesc[i].compareTo(other.partitionDesc[i]); if (partDiff != 0) { return partDiff; }