use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestMinMaxByAggregation method testMinLongArraySlice.
@Test
public void testMinLongArraySlice() {
InternalAggregationFunction function = getMinByAggregation(VARCHAR, new ArrayType(BIGINT));
assertAggregation(function, "c", createStringsBlock("a", "b", "c"), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestMinMaxByAggregation method testMinBooleanLongArray.
@Test
public void testMinBooleanLongArray() {
InternalAggregationFunction function = getMinByAggregation(new ArrayType(BIGINT), BOOLEAN);
assertAggregation(function, null, createArrayBigintBlock(asList(asList(3L, 4L), null, null)), createBooleansBlock(true, false, true));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestMinMaxByAggregation method testMaxDoubleLongArray.
@Test
public void testMaxDoubleLongArray() {
InternalAggregationFunction function = getMaxByAggregation(new ArrayType(BIGINT), DOUBLE);
assertAggregation(function, null, createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))), createDoublesBlock(1.0, 2.0, null));
assertAggregation(function, asList(2L, 2L), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))), createDoublesBlock(0.0, 1.0, 2.0));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestMinMaxByAggregation method testMinLongArrayLong.
@Test
public void testMinLongArrayLong() {
InternalAggregationFunction function = getMinByAggregation(BIGINT, new ArrayType(BIGINT));
assertAggregation(function, 3L, createLongsBlock(1L, 2L, 2L, 3L), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(8L, 9L), ImmutableList.of(1L, 2L), ImmutableList.of(6L, 7L), ImmutableList.of(1L, 1L))));
assertAggregation(function, -1L, createLongsBlock(0L, 1L, 2L, -1L), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(8L, 9L), ImmutableList.of(6L, 7L), ImmutableList.of(-1L, -3L), ImmutableList.of(-1L))));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestRowExpressionSerde method testArrayGet.
@Test
public void testArrayGet() {
assertEquals(getRoundTrip("(ARRAY [1, 2, 3])[1]", false), call(SUBSCRIPT.name(), operator(SUBSCRIPT, new ArrayType(INTEGER), BIGINT), INTEGER, call("array_constructor", function("array_constructor", INTEGER, INTEGER, INTEGER), new ArrayType(INTEGER), constant(1L, INTEGER), constant(2L, INTEGER), constant(3L, INTEGER)), constant(1L, INTEGER)));
assertEquals(getRoundTrip("(ARRAY [1, 2, 3])[1]", true), constant(1L, INTEGER));
}
Aggregations