public static Object distinctAggregation(InternalAggregationFunction function, Page... pages) { Optional<Integer> maskChannel = Optional.of(pages[0].getChannelCount()); // Execute normally Object aggregation = aggregation(function, createArgs(function), maskChannel, maskPages(true, pages)); Page[] dupedPages = new Page[pages.length * 2]; // Create two copies of each page with one of them masked off System.arraycopy(maskPages(true, pages), 0, dupedPages, 0, pages.length); System.arraycopy(maskPages(false, pages), 0, dupedPages, pages.length, pages.length); // Execute with masked pages and assure equal to normal execution Object aggregationWithDupes = aggregation(function, createArgs(function), maskChannel, dupedPages); assertEquals(aggregationWithDupes, aggregation, "Inconsistent results with mask"); return aggregation; }
public static Object distinctAggregation(InternalAggregationFunction function, double confidence, Page... pages) { Optional<Integer> maskChannel = Optional.of(pages[0].getChannelCount()); // Execute normally Object aggregation = aggregation(function, createArgs(function), maskChannel, confidence, maskPages(true, pages)); Page[] dupedPages = new Page[pages.length * 2]; // Create two copies of each page with one of them masked off System.arraycopy(maskPages(true, pages), 0, dupedPages, 0, pages.length); System.arraycopy(maskPages(false, pages), 0, dupedPages, pages.length, pages.length); // Execute with masked pages and assure equal to normal execution Object aggregationWithDupes = aggregation(function, createArgs(function), maskChannel, confidence, dupedPages); assertEquals(aggregationWithDupes, aggregation, "Inconsistent results with mask"); return aggregation; }