public static void input(LongState state, Block block, int index) { state.setLong(state.getLong() + 1); }
public static void input(LongState count, DoubleState sum, long value) { count.setLong(count.getLong() + 1); sum.setDouble(sum.getDouble() + intBitsToFloat((int) value)); }
public static void combine(LongState state, LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
@InputFunction public static void input(@AggregationState LongState state) { state.setLong(state.getLong() + 1); }
@InputFunction public static void input(@AggregationState LongState state, @SqlType(StandardTypes.BOOLEAN) boolean value) { if (value) { state.setLong(state.getLong() + 1); } }
@CombineFunction public static void combine(@AggregationState LongState state, @AggregationState LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
@CombineFunction public static void combine(@AggregationState LongState state, @AggregationState LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
public static void combine(LongState count, DoubleState sum, LongState otherCount, DoubleState otherSum) { count.setLong(count.getLong() + otherCount.getLong()); sum.setDouble(sum.getDouble() + otherSum.getDouble()); }
@Test public void testPrimitiveLongSerialization() { AccumulatorStateFactory<LongState> factory = StateCompiler.generateStateFactory(LongState.class); AccumulatorStateSerializer<LongState> serializer = StateCompiler.generateStateSerializer(LongState.class); LongState state = factory.createSingleState(); LongState deserializedState = factory.createSingleState(); state.setLong(2); BlockBuilder builder = BIGINT.createBlockBuilder(null, 1); 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()); }
public static void input(LongState state, Block block, int index) { state.setLong(state.getLong() + 1); }
@InputFunction public static void input(LongState state) { state.setLong(state.getLong() + 1); }
public static void combine(LongState state, LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
@InputFunction public static void input(LongState state, @SqlType(StandardTypes.BOOLEAN) boolean value) { if (value) { state.setLong(state.getLong() + 1); } }
@CombineFunction public static void combine(LongState state, LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
@CombineFunction public static void combine(LongState state, LongState otherState) { state.setLong(state.getLong() + otherState.getLong()); }
@Test public void testPrimitiveLongSerialization() { StateCompiler compiler = new StateCompiler(); AccumulatorStateFactory<LongState> factory = compiler.generateStateFactory(LongState.class); AccumulatorStateSerializer<LongState> serializer = compiler.generateStateSerializer(LongState.class); LongState state = factory.createSingleState(); LongState deserializedState = factory.createSingleState(); state.setLong(2); BlockBuilder builder = BIGINT.createBlockBuilder(new BlockBuilderStatus(), 1); 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()); }