/** * Generate the internal sorted hashmap for tags. Please note the partition tags should not be included in the result map. * @param partitions array of partition tags in order * @param tags tags of the entity * @return the sorted hash map of the tags */ public static SortedMap<Integer, Integer> generateSortedTagMap(String[] partitions, Map<String, String> tags) { final SortedMap<Integer, Integer> tagHashMap = new TreeMap<Integer, Integer>(); for (Map.Entry<String, String> entry: tags.entrySet()) { final String tagName = entry.getKey(); final String tagValue = entry.getValue(); // If it's a partition tag, we need to remove it from tag hash list. It need to // put to the fix partition hash slot in rowkey. if (tagValue == null || isPartitionTag(partitions, tagName)) continue; tagHashMap.put(tagName.hashCode(), tagValue.hashCode()); } return tagHashMap; }
/** * Generate the internal sorted hashmap for tags. Please note the partition tags should not be included in * the result map. * * @param partitions array of partition tags in order * @param tags tags of the entity * @return the sorted hash map of the tags */ public static SortedMap<Integer, Integer> generateSortedTagMap(String[] partitions, Map<String, String> tags) { final SortedMap<Integer, Integer> tagHashMap = new TreeMap<Integer, Integer>(); for (Map.Entry<String, String> entry : tags.entrySet()) { final String tagName = entry.getKey(); final String tagValue = entry.getValue(); // If it's a partition tag, we need to remove it from tag hash list. It need to // put to the fix partition hash slot in rowkey. if (tagValue == null || isPartitionTag(partitions, tagName)) { continue; } tagHashMap.put(tagName.hashCode(), tagValue.hashCode()); } return tagHashMap; }