private static boolean exceedCap(Dim[] dims, long cap) { return combCount(dims) > cap; }
public static <K, V> List<Map<K, V>> calculate(Map<K, Set<V>> fuzzyValues, long cap) { Dim<K, V>[] dims = toDims(fuzzyValues); // If a query has many IN clause and each IN clause has many values, then it will easily generate // thousands of fuzzy keys. When there are lots of fuzzy keys, the scan performance is bottle necked // on it. So simply choose to abandon all fuzzy keys in this case. if (exceedCap(dims, cap)) { return Lists.newArrayList(); } else { return combination(dims); } }
private List<GTRecord> buildFuzzyKeys(Map<Integer, Set<ByteArray>> fuzzyValueSet) { ArrayList<GTRecord> result = Lists.newArrayList(); if (fuzzyValueSet.isEmpty()) return result; // debug/profiling purpose if (BackdoorToggles.getDisableFuzzyKey()) { logger.info("The execution of this query will not use fuzzy key"); return result; } List<Map<Integer, ByteArray>> fuzzyValueCombinations = FuzzyValueCombination.calculate(fuzzyValueSet, maxFuzzyKeys); for (Map<Integer, ByteArray> fuzzyValue : fuzzyValueCombinations) { GTRecord fuzzy = new GTRecord(gtInfo); for (Map.Entry<Integer, ByteArray> entry : fuzzyValue.entrySet()) { fuzzy.set(entry.getKey(), entry.getValue()); } result.add(fuzzy); } return result; }
private List<GTRecord> buildFuzzyKeys(Map<Integer, Set<ByteArray>> fuzzyValueSet) { ArrayList<GTRecord> result = Lists.newArrayList(); if (fuzzyValueSet.isEmpty()) return result; // debug/profiling purpose if (BackdoorToggles.getDisableFuzzyKey()) { logger.info("The execution of this query will not use fuzzy key"); return result; } List<Map<Integer, ByteArray>> fuzzyValueCombinations = FuzzyValueCombination.calculate(fuzzyValueSet, maxFuzzyKeys); for (Map<Integer, ByteArray> fuzzyValue : fuzzyValueCombinations) { GTRecord fuzzy = new GTRecord(gtInfo); for (Map.Entry<Integer, ByteArray> entry : fuzzyValue.entrySet()) { fuzzy.set(entry.getKey(), entry.getValue()); } result.add(fuzzy); } return result; }
public static <K, V> List<Map<K, V>> calculate(Map<K, Set<V>> fuzzyValues, long cap) { Dim<K, V>[] dims = toDims(fuzzyValues); // If a query has many IN clause and each IN clause has many values, then it will easily generate // thousands of fuzzy keys. When there are lots of fuzzy keys, the scan performance is bottle necked // on it. So simply choose to abandon all fuzzy keys in this case. if (exceedCap(dims, cap)) { return Lists.newArrayList(); } else { return combination(dims); } }
private static boolean exceedCap(Dim[] dims, long cap) { return combCount(dims) > cap; }