Java Code Examples for org.apache.flink.types.IntValue#getValue()

The following examples show how to use org.apache.flink.types.IntValue#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntValueArray.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public boolean add(IntValue value) {
	int newPosition = position + 1;

	if (newPosition > data.length) {
		if (isBounded) {
			return false;
		} else {
			ensureCapacity(newPosition);
		}
	}

	data[position] = value.getValue();
	position = newPosition;

	return true;
}
 
Example 2
Source File: IntValueArray.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public boolean add(IntValue value) {
	int newPosition = position + 1;

	if (newPosition > data.length) {
		if (isBounded) {
			return false;
		} else {
			ensureCapacity(newPosition);
		}
	}

	data[position] = value.getValue();
	position = newPosition;

	return true;
}
 
Example 3
Source File: IntValueArray.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public boolean add(IntValue value) {
	int newPosition = position + 1;

	if (newPosition > data.length) {
		if (isBounded) {
			return false;
		} else {
			ensureCapacity(newPosition);
		}
	}

	data[position] = value.getValue();
	position = newPosition;

	return true;
}
 
Example 4
Source File: TestingAbstractInvokables.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke() throws Exception {
	final RecordReader<IntValue> reader = new RecordReader<>(
		getEnvironment().getInputGate(0),
		IntValue.class,
		getEnvironment().getTaskManagerInfo().getTmpDirectories());

	final IntValue i1 = reader.next();
	final IntValue i2 = reader.next();
	final IntValue i3 = reader.next();

	if (i1.getValue() != 42 || i2.getValue() != 1337 || i3 != null) {
		throw new Exception("Wrong data received.");
	}
}
 
Example 5
Source File: TestingAbstractInvokables.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke() throws Exception {
	final RecordReader<IntValue> reader = new RecordReader<>(
		getEnvironment().getInputGate(0),
		IntValue.class,
		getEnvironment().getTaskManagerInfo().getTmpDirectories());

	final IntValue i1 = reader.next();
	final IntValue i2 = reader.next();
	final IntValue i3 = reader.next();

	if (i1.getValue() != 42 || i2.getValue() != 1337 || i3 != null) {
		throw new Exception("Wrong data received.");
	}
}
 
Example 6
Source File: TestingAbstractInvokables.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke() throws Exception {
	final RecordReader<IntValue> reader = new RecordReader<>(
		getEnvironment().getInputGate(0),
		IntValue.class,
		getEnvironment().getTaskManagerInfo().getTmpDirectories());

	final IntValue i1 = reader.next();
	final IntValue i2 = reader.next();
	final IntValue i3 = reader.next();

	if (i1.getValue() != 42 || i2.getValue() != 1337 || i3 != null) {
		throw new Exception("Wrong data received.");
	}
}
 
Example 7
Source File: SumAggregationFunction.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(IntValue value) {
	agg += value.getValue();
}
 
Example 8
Source File: ValueSummaryAggregator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected Integer getValue(IntValue value) {
	return value.getValue();
}
 
Example 9
Source File: SlotCountExceedingParallelismTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void invoke() throws Exception {
	RecordReader<IntValue> reader = new RecordReader<>(
			getEnvironment().getInputGate(0),
			IntValue.class,
			getEnvironment().getTaskManagerInfo().getTmpDirectories());

	try {
		final int numberOfSubtaskIndexesToReceive = getTaskConfiguration().getInteger(CONFIG_KEY, 0);
		final BitSet receivedSubtaskIndexes = new BitSet(numberOfSubtaskIndexesToReceive);

		IntValue record;

		int numberOfReceivedSubtaskIndexes = 0;

		while ((record = reader.next()) != null) {
			// Check that we don't receive more than expected
			numberOfReceivedSubtaskIndexes++;

			if (numberOfReceivedSubtaskIndexes > numberOfSubtaskIndexesToReceive) {
				throw new IllegalStateException("Received more records than expected.");
			}

			int subtaskIndex = record.getValue();

			// Check that we only receive each subtask index once
			if (receivedSubtaskIndexes.get(subtaskIndex)) {
				throw new IllegalStateException("Received expected subtask index twice.");
			}
			else {
				receivedSubtaskIndexes.set(subtaskIndex, true);
			}
		}

		// Check that we have received all expected subtask indexes
		if (receivedSubtaskIndexes.cardinality() != numberOfSubtaskIndexesToReceive) {
			throw new IllegalStateException("Finished receive, but did not receive "
					+ "all expected subtask indexes.");
		}
	}
	finally {
		reader.clearBuffers();
	}
}
 
Example 10
Source File: SumAggregationFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(IntValue value) {
	agg += value.getValue();
}
 
Example 11
Source File: ValueSummaryAggregator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected Integer getValue(IntValue value) {
	return value.getValue();
}
 
Example 12
Source File: SlotCountExceedingParallelismTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void invoke() throws Exception {
	RecordReader<IntValue> reader = new RecordReader<>(
			getEnvironment().getInputGate(0),
			IntValue.class,
			getEnvironment().getTaskManagerInfo().getTmpDirectories());

	try {
		final int numberOfSubtaskIndexesToReceive = getTaskConfiguration().getInteger(CONFIG_KEY, 0);
		final BitSet receivedSubtaskIndexes = new BitSet(numberOfSubtaskIndexesToReceive);

		IntValue record;

		int numberOfReceivedSubtaskIndexes = 0;

		while ((record = reader.next()) != null) {
			// Check that we don't receive more than expected
			numberOfReceivedSubtaskIndexes++;

			if (numberOfReceivedSubtaskIndexes > numberOfSubtaskIndexesToReceive) {
				throw new IllegalStateException("Received more records than expected.");
			}

			int subtaskIndex = record.getValue();

			// Check that we only receive each subtask index once
			if (receivedSubtaskIndexes.get(subtaskIndex)) {
				throw new IllegalStateException("Received expected subtask index twice.");
			}
			else {
				receivedSubtaskIndexes.set(subtaskIndex, true);
			}
		}

		// Check that we have received all expected subtask indexes
		if (receivedSubtaskIndexes.cardinality() != numberOfSubtaskIndexesToReceive) {
			throw new IllegalStateException("Finished receive, but did not receive "
					+ "all expected subtask indexes.");
		}
	}
	finally {
		reader.clearBuffers();
	}
}
 
Example 13
Source File: SumAggregationFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(IntValue value) {
	agg += value.getValue();
}
 
Example 14
Source File: ValueSummaryAggregator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected Integer getValue(IntValue value) {
	return value.getValue();
}
 
Example 15
Source File: SlotCountExceedingParallelismTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void invoke() throws Exception {
	RecordReader<IntValue> reader = new RecordReader<>(
			getEnvironment().getInputGate(0),
			IntValue.class,
			getEnvironment().getTaskManagerInfo().getTmpDirectories());

	try {
		final int numberOfSubtaskIndexesToReceive = getTaskConfiguration().getInteger(CONFIG_KEY, 0);
		final BitSet receivedSubtaskIndexes = new BitSet(numberOfSubtaskIndexesToReceive);

		IntValue record;

		int numberOfReceivedSubtaskIndexes = 0;

		while ((record = reader.next()) != null) {
			// Check that we don't receive more than expected
			numberOfReceivedSubtaskIndexes++;

			if (numberOfReceivedSubtaskIndexes > numberOfSubtaskIndexesToReceive) {
				throw new IllegalStateException("Received more records than expected.");
			}

			int subtaskIndex = record.getValue();

			// Check that we only receive each subtask index once
			if (receivedSubtaskIndexes.get(subtaskIndex)) {
				throw new IllegalStateException("Received expected subtask index twice.");
			}
			else {
				receivedSubtaskIndexes.set(subtaskIndex, true);
			}
		}

		// Check that we have received all expected subtask indexes
		if (receivedSubtaskIndexes.cardinality() != numberOfSubtaskIndexesToReceive) {
			throw new IllegalStateException("Finished receive, but did not receive "
					+ "all expected subtask indexes.");
		}
	}
	finally {
		reader.clearBuffers();
	}
}