use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.
the class TestMinMaxByAggregation method testMinLongArrayLongArray.
@Test
public void testMinLongArrayLongArray() {
InternalAggregationFunction function = getMinByAggregation(new ArrayType(BIGINT), new ArrayType(BIGINT));
assertAggregation(function, asList(1L, 2L), createArrayBigintBlock(asList(asList(3L, 3L), null, asList(1L, 2L))), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))));
}
use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.
the class TestMinMaxByAggregation method testMaxUnknownSlice.
@Test
public void testMaxUnknownSlice() {
InternalAggregationFunction function = getMaxByAggregation(VARCHAR, UNKNOWN);
assertAggregation(function, null, createStringsBlock("a", "b", "c"), createArrayBigintBlock(asList(null, null, null)));
}
use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.
the class TestMinMaxByAggregation method testMaxLongLongArray.
@Test
public void testMaxLongLongArray() {
InternalAggregationFunction function = getMaxByAggregation(new ArrayType(BIGINT), BIGINT);
assertAggregation(function, ImmutableList.of(1L, 2L), createArrayBigintBlock(asList(asList(3L, 4L), asList(1L, 2L), null)), createLongsBlock(1L, 2L, null));
assertAggregation(function, ImmutableList.of(2L, 3L), createArrayBigintBlock(asList(asList(3L, 4L), asList(2L, 3L), null, asList(1L, 2L))), createLongsBlock(0L, 1L, null, -1L));
}
use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.
the class TestIllegalMethodAggregation method testNullMethod.
@Test
public void testNullMethod() {
FunctionAndTypeManager functionAndTypeManager = MetadataManager.createTestMetadataManager().getFunctionAndTypeManager();
InternalAggregationFunction function = functionAndTypeManager.getAggregateFunctionImplementation(functionAndTypeManager.lookupFunction("differential_entropy", fromTypes(BIGINT, DOUBLE, DOUBLE, VARCHAR, DOUBLE, DOUBLE)));
createStringsBlock((String) null);
aggregation(function, createLongsBlock(200), createDoublesBlock(0.1), createDoublesBlock(-0.2), createStringsBlock((String) null), createDoublesBlock(0.0), createDoublesBlock(1.0));
}
use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.
the class TestMinMaxByNAggregation method testMaxDoubleDouble.
@Test
public void testMaxDoubleDouble() {
InternalAggregationFunction function = getMaxByAggregation(DOUBLE, DOUBLE, BIGINT);
assertAggregation(function, Arrays.asList((Double) null), createDoublesBlock(1.0, null), createDoublesBlock(3.0, 5.0), createRLEBlock(1L, 2));
assertAggregation(function, null, createDoublesBlock(null, null), createDoublesBlock(null, null), createRLEBlock(1L, 2));
assertAggregation(function, Arrays.asList(1.0), createDoublesBlock(null, 1.0, null, null), createDoublesBlock(null, 0.0, null, null), createRLEBlock(2L, 4));
assertAggregation(function, Arrays.asList(1.0), createDoublesBlock(1.0), createDoublesBlock(0.0), createRLEBlock(2L, 1));
assertAggregation(function, null, createDoublesBlock(), createDoublesBlock(), createRLEBlock(2L, 0));
assertAggregation(function, ImmutableList.of(2.5), createDoublesBlock(2.5, 2.0, 5.0, 3.0), createDoublesBlock(4.0, 1.5, 2.0, 3.0), createRLEBlock(1L, 4));
assertAggregation(function, ImmutableList.of(2.5, 3.0), createDoublesBlock(2.5, 2.0, 5.0, 3.0), createDoublesBlock(4.0, 1.5, 2.0, 3.0), createRLEBlock(2L, 4));
}
Aggregations