Package com.facebook.presto.operator.aggregation.state

Examples of com.facebook.presto.operator.aggregation.state.NullableBigintState


    {
        StateCompiler compiler = new StateCompiler();

        AccumulatorStateFactory<NullableBigintState> factory = compiler.generateStateFactory(NullableBigintState.class);
        AccumulatorStateSerializer<NullableBigintState> serializer = compiler.generateStateSerializer(NullableBigintState.class);
        NullableBigintState state = factory.createSingleState();
        NullableBigintState deserializedState = factory.createSingleState();

        state.setLong(2);
        state.setNull(false);

        BlockBuilder builder = BigintType.BIGINT.createBlockBuilder(new BlockBuilderStatus());
        serializer.serialize(state, builder);
        state.setNull(true);
        serializer.serialize(state, builder);

        Block block = builder.build();

        assertEquals(BIGINT.getLong(block, 0), state.getLong());
        serializer.deserialize(block, 0, deserializedState);
        assertEquals(deserializedState.getLong(), state.getLong());

        assertEquals(block.isNull(1), state.isNull());
        serializer.deserialize(block, 1, deserializedState);
        assertEquals(deserializedState.isNull(), state.isNull());
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.operator.aggregation.state.NullableBigintState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.