/** * Indicate if the weight check query can be skipped based on heuristics. * * @param query Query to test * * @return true if the weight check query does not need to be run */ public boolean skipWeightCheckQuery(DruidAggregationQuery<?> query) { try { long worstCaseRows = WeightEvaluationQuery.getWorstCaseWeightEstimate(query); double skipThreshold = getQueryWeightThreshold(query.getGranularity()) / weightCheckBypassFactor; return worstCaseRows <= skipThreshold; } catch (ArithmeticException ignored) { // We got a really big estimate, so don't skip the check LOG.debug("worst case weight larger than {}", Long.MAX_VALUE); return false; } }