use of io.trino.sql.planner.rowpattern.AggregatedSetDescriptor in project trino by trinodb.
the class TestPatternRecognitionNodeSerialization method testAggregationValuePointerRoundtrip.
@Test
public void testAggregationValuePointerRoundtrip() {
ObjectMapperProvider provider = new ObjectMapperProvider();
provider.setJsonSerializers(ImmutableMap.of(Expression.class, new ExpressionSerialization.ExpressionSerializer()));
provider.setJsonDeserializers(ImmutableMap.of(Expression.class, new ExpressionSerialization.ExpressionDeserializer(new SqlParser()), Type.class, new TypeDeserializer(TESTING_TYPE_MANAGER)));
provider.setKeyDeserializers(ImmutableMap.of(TypeSignature.class, new TypeSignatureKeyDeserializer()));
JsonCodec<ValuePointer> codec = new JsonCodecFactory(provider).jsonCodec(ValuePointer.class);
ResolvedFunction countFunction = createTestMetadataManager().resolveFunction(TEST_SESSION, QualifiedName.of("count"), ImmutableList.of());
assertJsonRoundTrip(codec, new AggregationValuePointer(countFunction, new AggregatedSetDescriptor(ImmutableSet.of(), false), ImmutableList.of(), new Symbol("classifier"), new Symbol("match_number")));
ResolvedFunction maxFunction = createTestMetadataManager().resolveFunction(TEST_SESSION, QualifiedName.of("max"), fromTypes(BIGINT));
assertJsonRoundTrip(codec, new AggregationValuePointer(maxFunction, new AggregatedSetDescriptor(ImmutableSet.of(new IrLabel("A"), new IrLabel("B")), true), ImmutableList.of(new NullLiteral()), new Symbol("classifier"), new Symbol("match_number")));
}
Aggregations