use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.
the class TestMinMaxByAggregation method testMinLongArrayLongArray.
@Test
public void testMinLongArrayLongArray() {
List<TypeSignatureProvider> parameterTypes = fromTypes(new ArrayType(BIGINT), new ArrayType(BIGINT));
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, asList(1L, 2L), createArrayBigintBlock(asList(asList(3L, 3L), null, asList(1L, 2L))), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))));
}
use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.
the class TestMinMaxByAggregation method testMinDoubleLongArray.
@Test
public void testMinDoubleLongArray() {
List<TypeSignatureProvider> parameterTypes = fromTypes(new ArrayType(BIGINT), DOUBLE);
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, asList(3L, 4L), createArrayBigintBlock(asList(asList(3L, 4L), null, asList(2L, 2L))), createDoublesBlock(1.0, 2.0, 3.0));
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, null, createArrayBigintBlock(asList(null, null, asList(2L, 2L))), createDoublesBlock(0.0, 1.0, 2.0));
}
use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.
the class TestMinMaxByAggregation method testMaxLongLongArray.
@Test
public void testMaxLongLongArray() {
List<TypeSignatureProvider> parameterTypes = fromTypes(new ArrayType(BIGINT), BIGINT);
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("max_by"), parameterTypes, ImmutableList.of(1L, 2L), createArrayBigintBlock(asList(asList(3L, 4L), asList(1L, 2L), null)), createLongsBlock(1L, 2L, null));
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("max_by"), parameterTypes, ImmutableList.of(2L, 3L), createArrayBigintBlock(asList(asList(3L, 4L), asList(2L, 3L), null, asList(1L, 2L))), createLongsBlock(0L, 1L, null, -1L));
}
use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.
the class TestMinMaxByAggregation method testMaxUnknownLongArray.
@Test
public void testMaxUnknownLongArray() {
List<TypeSignatureProvider> parameterTypes = fromTypes(new ArrayType(BIGINT), UNKNOWN);
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("max_by"), parameterTypes, null, createArrayBigintBlock(asList(asList(3L, 3L), null, asList(1L, 2L))), createArrayBigintBlock(asList(null, null, null)));
}
use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.
the class TestMinMaxByNAggregation method testMinArrayVarchar.
@Test
public void testMinArrayVarchar() {
List<TypeSignatureProvider> parameterTypes = fromTypes(VARCHAR, new ArrayType(BIGINT), BIGINT);
assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, ImmutableList.of("b", "x", "z"), createStringsBlock("z", "a", "x", "b"), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(1L, 2L), ImmutableList.of(2L, 3L), ImmutableList.of(0L, 3L), ImmutableList.of(0L, 2L))), createRLEBlock(3L, 4));
}
Aggregations