Search in sources :

Example 21 with TypeSignatureProvider

use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.

the class TestMinMaxByAggregation method testMaxLongArrayLong.

@Test
public void testMaxLongArrayLong() {
    List<TypeSignatureProvider> parameterTypes = fromTypes(BIGINT, new ArrayType(BIGINT));
    assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("max_by"), parameterTypes, 1L, 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_RESOLUTION, QualifiedName.of("max_by"), parameterTypes, 2L, createLongsBlock(0L, 1L, 2L, -1L), createArrayBigintBlock(ImmutableList.of(ImmutableList.of(-8L, 9L), ImmutableList.of(-6L, 7L), ImmutableList.of(-1L, -3L), ImmutableList.of(-1L))));
}
Also used : TypeSignatureProvider(io.trino.sql.analyzer.TypeSignatureProvider) ArrayType(io.trino.spi.type.ArrayType) Test(org.testng.annotations.Test)

Example 22 with TypeSignatureProvider

use of io.trino.sql.analyzer.TypeSignatureProvider in project trino by trinodb.

the class TestMinMaxByAggregation method testMinLongLongArray.

@Test
public void testMinLongLongArray() {
    List<TypeSignatureProvider> parameterTypes = fromTypes(new ArrayType(BIGINT), BIGINT);
    assertAggregation(FUNCTION_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, 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_RESOLUTION, QualifiedName.of("min_by"), parameterTypes, 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 : TypeSignatureProvider(io.trino.sql.analyzer.TypeSignatureProvider) ArrayType(io.trino.spi.type.ArrayType) Test(org.testng.annotations.Test)

Aggregations

TypeSignatureProvider (io.trino.sql.analyzer.TypeSignatureProvider)22 ArrayType (io.trino.spi.type.ArrayType)21 Test (org.testng.annotations.Test)21 ImmutableList (com.google.common.collect.ImmutableList)2 RowType (io.trino.spi.type.RowType)2 Type (io.trino.spi.type.Type)2 TypeSignature (io.trino.spi.type.TypeSignature)2 TypeSignatureParameter (io.trino.spi.type.TypeSignatureParameter)2 FunctionType (io.trino.type.FunctionType)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 TEST_SESSION (io.trino.SessionTestUtils.TEST_SESSION)1 Signature.castableFromTypeParameter (io.trino.metadata.Signature.castableFromTypeParameter)1 Signature.castableToTypeParameter (io.trino.metadata.Signature.castableToTypeParameter)1 Signature.comparableTypeParameter (io.trino.metadata.Signature.comparableTypeParameter)1 Signature.orderableTypeParameter (io.trino.metadata.Signature.orderableTypeParameter)1 Signature.typeVariable (io.trino.metadata.Signature.typeVariable)1 Signature.withVariadicBound (io.trino.metadata.Signature.withVariadicBound)1 BIGINT (io.trino.spi.type.BigintType.BIGINT)1 BOOLEAN (io.trino.spi.type.BooleanType.BOOLEAN)1