private void testCustomAggregation(Long[] values, int n) { PriorityQueue<Long> heap = new PriorityQueue<>(n); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); ImmutableList.Builder<List<Long>> expected = new ImmutableList.Builder<>(); for (int i = heap.size() - 1; i >= 0; i--) { expected.add(ImmutableList.of(heap.remove())); } testAggregation(Lists.reverse(expected.build()), createLongArraysBlock(values), createLongRepeatBlock(n, values.length)); } }
private void testCustomAggregation(Long[] values, int n) { PriorityQueue<Long> heap = new PriorityQueue<>(n); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); Long[] expected = new Long[heap.size()]; for (int i = heap.size() - 1; i >= 0; i--) { expected[i] = heap.remove(); } testAggregation(Arrays.asList(expected), createLongsBlock(values), createLongRepeatBlock(n, values.length)); } }
@Override public Block[] getSequenceBlocks(int start, int length) { return new Block[] {createDoubleSequenceBlock(start, start + length), createLongRepeatBlock(2, length)}; }
@Override public Block[] getSequenceBlocks(int start, int length) { return new Block[] {createLongArraySequenceBlock(start, start + length), createLongRepeatBlock(2, length)}; }
@Override public Block[] getSequenceBlocks(int start, int length) { return new Block[] {createLongSequenceBlock(start, start + length), createLongRepeatBlock(2, length)}; }
private void testCustomAggregation(Double[] values, int n) { PriorityQueue<Double> heap = new PriorityQueue<>(n, (x, y) -> -Double.compare(x, y)); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); Double[] expected = new Double[heap.size()]; for (int i = heap.size() - 1; i >= 0; i--) { expected[i] = heap.remove(); } testAggregation(Arrays.asList(expected), createDoublesBlock(values), createLongRepeatBlock(n, values.length)); } }
private void testInvalidAggregation(Double[] x, int n) { try { testAggregation(new long[] {}, createDoublesBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(null, createLongArraysBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(new long[] {}, createLongsBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
9900.0, createDoubleSequenceBlock(0, 10000), createLongRepeatBlock(1, 10000), createRLEBlock(0.99, 10000), createRLEBlock(0.001, 10000));
9900L, createLongSequenceBlock(0, 10000), createLongRepeatBlock(1, 10000), createRLEBlock(0.99, 10000), createRLEBlock(0.001, 10000));
9900.0f, createSequenceBlockOfReal(0, 10000), createLongRepeatBlock(1, 10000), createRLEBlock(0.99, 10000), createRLEBlock(0.001, 10000));
@Override public Block[] getSequenceBlocks(int start, int length) { return new Block[] {createDoubleSequenceBlock(start, start + length), createLongRepeatBlock(2, length)}; }
@Override public Block[] getSequenceBlocks(int start, int length) { return new Block[] {createLongArraySequenceBlock(start, start + length), createLongRepeatBlock(2, length)}; }
private void testCustomAggregation(Double[] values, int n) { PriorityQueue<Double> heap = new PriorityQueue<>(n, (x, y) -> -Double.compare(x, y)); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); Double[] expected = new Double[heap.size()]; for (int i = heap.size() - 1; i >= 0; i--) { expected[i] = heap.remove(); } testAggregation(Arrays.asList(expected), createDoublesBlock(values), createLongRepeatBlock(n, values.length)); } }
private void testCustomAggregation(Long[] values, int n) { PriorityQueue<Long> heap = new PriorityQueue<Long>(n); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); ImmutableList.Builder<List<Long>> expected = new ImmutableList.Builder<>(); for (int i = heap.size() - 1; i >= 0; i--) { expected.add(ImmutableList.of(heap.remove())); } testAggregation(Lists.reverse(expected.build()), createLongArraysBlock(values), createLongRepeatBlock(n, values.length)); } }
private void testCustomAggregation(Long[] values, int n) { PriorityQueue<Long> heap = new PriorityQueue<Long>(n); Arrays.stream(values).filter(x -> x != null).forEach(heap::add); Long[] expected = new Long[heap.size()]; for (int i = heap.size() - 1; i >= 0; i--) { expected[i] = heap.remove(); } testAggregation(Arrays.asList(expected), createLongsBlock(values), createLongRepeatBlock(n, values.length)); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(null, createLongArraysBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Double[] x, int n) { try { testAggregation(new long[] {}, createDoublesBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }
private void testInvalidAggregation(Long[] x, int n) { try { testAggregation(new long[] {}, createLongsBlock(x), createLongRepeatBlock(n, x.length)); } catch (PrestoException e) { assertEquals(e.getErrorCode().getName(), INVALID_FUNCTION_ARGUMENT.name()); } }