@Test
public void testDoubleRowMap()
throws Exception
{
RowType innerRowType = new RowType(ImmutableList.of(BIGINT, DOUBLE), Optional.of(ImmutableList.of("f1", "f2")));
MapType mapType = new MapType(DOUBLE, innerRowType);
InternalAggregationFunction aggFunc = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature(NAME,
AGGREGATE,
mapType.getTypeSignature().toString(),
StandardTypes.DOUBLE,
innerRowType.getTypeSignature().toString()));
BlockBuilder builder = innerRowType.createBlockBuilder(new BlockBuilderStatus(), 3);
innerRowType.writeObject(builder, testRowBigintBigint(1L, 1.0));
innerRowType.writeObject(builder, testRowBigintBigint(2L, 2.0));
innerRowType.writeObject(builder, testRowBigintBigint(3L, 3.0));
assertAggregation(
aggFunc,
1.0,
ImmutableMap.of(1.0, ImmutableList.of(1L, 1.0),
2.0, ImmutableList.of(2L, 2.0),
3.0, ImmutableList.of(3L, 3.0)),
createDoublesBlock(1.0, 2.0, 3.0),
builder.build());
}