Search in sources :

Example 71 with InternalAggregationFunction

use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.

the class TestMinMaxByAggregation method testMinLongLongArray.

@Test
public void testMinLongLongArray() {
    InternalAggregationFunction function = getMinByAggregation(new ArrayType(BIGINT), BIGINT);
    assertAggregation(function, ImmutableList.of(8L, 9L), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(8L, 9L), ImmutableList.of(1L, 2L), ImmutableList.of(6L, 7L), ImmutableList.of(2L, 3L))), createLongsBlock(1L, 2L, 2L, 3L));
    assertAggregation(function, ImmutableList.of(2L), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(8L, 9L), ImmutableList.of(6L, 7L), ImmutableList.of(2L, 3L), ImmutableList.of(2L))), createLongsBlock(0L, 1L, 2L, -1L));
}
Also used : ArrayType(com.facebook.presto.common.type.ArrayType) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) Test(org.testng.annotations.Test)

Example 72 with InternalAggregationFunction

use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.

the class TestMinMaxByAggregation method testMaxLongArrayLongArray.

@Test
public void testMaxLongArrayLongArray() {
    InternalAggregationFunction function = getMaxByAggregation(new ArrayType(BIGINT), new ArrayType(BIGINT));
    assertAggregation(function, asList(3L, 3L), createArrayBigintBlock(asList(asList(3L, 3L), null, asList(1L, 2L))), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))));
}
Also used : ArrayType(com.facebook.presto.common.type.ArrayType) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) Test(org.testng.annotations.Test)

Example 73 with InternalAggregationFunction

use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.

the class TestMinMaxByAggregation method testMinSliceLongArray.

@Test
public void testMinSliceLongArray() {
    InternalAggregationFunction function = getMinByAggregation(new ArrayType(BIGINT), VARCHAR);
    assertAggregation(function, asList(3L, 4L), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))), createStringsBlock("a", "b", "c"));
    assertAggregation(function, null, createArrayBigintBlock(asList(null, null, asList(2L, 2L))), createStringsBlock("a", "b", "c"));
}
Also used : ArrayType(com.facebook.presto.common.type.ArrayType) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) Test(org.testng.annotations.Test)

Example 74 with InternalAggregationFunction

use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.

the class TestMinMaxByAggregation method testMinUnknownLongArray.

@Test
public void testMinUnknownLongArray() {
    InternalAggregationFunction function = getMinByAggregation(new ArrayType(BIGINT), UNKNOWN);
    assertAggregation(function, null, createArrayBigintBlock(asList(asList(3L, 3L), null, asList(1L, 2L))), createArrayBigintBlock(asList(null, null, null)));
}
Also used : ArrayType(com.facebook.presto.common.type.ArrayType) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) Test(org.testng.annotations.Test)

Example 75 with InternalAggregationFunction

use of com.facebook.presto.operator.aggregation.InternalAggregationFunction in project presto by prestodb.

the class TestMinMaxByAggregation method testMaxBooleanVarchar.

@Test
public void testMaxBooleanVarchar() {
    InternalAggregationFunction function = getMaxByAggregation(VARCHAR, BOOLEAN);
    assertAggregation(function, "c", createStringsBlock("a", "b", "c"), createBooleansBlock(false, false, true));
}
Also used : InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction) Test(org.testng.annotations.Test)

Aggregations

InternalAggregationFunction (com.facebook.presto.operator.aggregation.InternalAggregationFunction)89 Test (org.testng.annotations.Test)73 ArrayType (com.facebook.presto.common.type.ArrayType)31 AggregationMetadata (com.facebook.presto.operator.aggregation.AggregationMetadata)20 Type (com.facebook.presto.common.type.Type)17 ParametricAggregation (com.facebook.presto.operator.aggregation.ParametricAggregation)14 AggregationImplementation (com.facebook.presto.operator.aggregation.AggregationImplementation)13 TypeSignature (com.facebook.presto.common.type.TypeSignature)12 TypeSignature.parseTypeSignature (com.facebook.presto.common.type.TypeSignature.parseTypeSignature)12 Signature (com.facebook.presto.spi.function.Signature)12 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)9 DynamicClassLoader (com.facebook.presto.bytecode.DynamicClassLoader)8 Page (com.facebook.presto.common.Page)8 GenericAccumulatorFactoryBinder (com.facebook.presto.operator.aggregation.GenericAccumulatorFactoryBinder)8 AccumulatorStateDescriptor (com.facebook.presto.operator.aggregation.AggregationMetadata.AccumulatorStateDescriptor)7 RowPagesBuilder (com.facebook.presto.RowPagesBuilder)6 HashAggregationOperatorFactory (com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory)6 DataSize (io.airlift.units.DataSize)6 FunctionAndTypeManager (com.facebook.presto.metadata.FunctionAndTypeManager)5 DecimalType.createDecimalType (com.facebook.presto.common.type.DecimalType.createDecimalType)4