use of com.facebook.presto.metadata.Signature in project presto by prestodb.
the class TestArrayAggregation method testEmpty.
@Test
public void testEmpty() throws Exception {
InternalAggregationFunction bigIntAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("array_agg", AGGREGATE, parseTypeSignature("array(bigint)"), parseTypeSignature(StandardTypes.BIGINT)));
assertAggregation(bigIntAgg, null, createLongsBlock(new Long[] {}));
}
use of com.facebook.presto.metadata.Signature in project presto by prestodb.
the class TestArrayAggregation method testArray.
@Test
public void testArray() throws Exception {
InternalAggregationFunction varcharAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("array_agg", AGGREGATE, parseTypeSignature("array(array(bigint))"), parseTypeSignature("array(bigint)")));
assertAggregation(varcharAgg, Arrays.asList(Arrays.asList(1L), Arrays.asList(1L, 2L), Arrays.asList(1L, 2L, 3L)), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(1L), ImmutableList.of(1L, 2L), ImmutableList.of(1L, 2L, 3L))));
}
use of com.facebook.presto.metadata.Signature in project presto by prestodb.
the class TestArrayAggregation method testBoolean.
@Test
public void testBoolean() throws Exception {
InternalAggregationFunction booleanAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("array_agg", AGGREGATE, parseTypeSignature("array(boolean)"), parseTypeSignature(StandardTypes.BOOLEAN)));
assertAggregation(booleanAgg, Arrays.asList(true, false), createBooleansBlock(new Boolean[] { true, false }));
}
use of com.facebook.presto.metadata.Signature in project presto by prestodb.
the class TestChecksumAggregation method testLongDecimal.
@Test
public void testLongDecimal() throws Exception {
InternalAggregationFunction decimalAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("checksum", AGGREGATE, parseTypeSignature(VARBINARY), parseTypeSignature("decimal(19,2)")));
Block block = createLongDecimalsBlock("11.11", "22.22", null, "33.33", "44.44");
DecimalType longDecimalType = DecimalType.createDecimalType(19);
assertAggregation(decimalAgg, expectedChecksum(longDecimalType, block), block);
}
use of com.facebook.presto.metadata.Signature in project presto by prestodb.
the class TestChecksumAggregation method testDouble.
@Test
public void testDouble() throws Exception {
InternalAggregationFunction doubleAgg = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("checksum", AGGREGATE, parseTypeSignature(VARBINARY), parseTypeSignature(DOUBLE)));
Block block = createDoublesBlock(null, 2.0, null, 3.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN);
assertAggregation(doubleAgg, expectedChecksum(DoubleType.DOUBLE, block), block);
}
Aggregations