org.apache.flink.api.common.state.MergingState Java Examples

The following examples show how to use org.apache.flink.api.common.state.MergingState. 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: WindowOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	if (mergedWindows != null && mergedWindows.size() > 0) {
		try {
			S rawState = getKeyedStateBackend().getOrCreateKeyedState(windowSerializer, stateDescriptor);

			if (rawState instanceof InternalMergingState) {
				@SuppressWarnings("unchecked")
				InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
				mergingState.mergeNamespaces(window, mergedWindows);
			}
			else {
				throw new IllegalArgumentException(
						"The given state descriptor does not refer to a mergeable state (MergingState)");
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Error while merging state.", e);
		}
	}
}
 
Example #2
Source File: TriggerTestHarness.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	try {
		S rawState = stateBackend.getOrCreateKeyedState(windowSerializer, stateDescriptor);

		if (rawState instanceof InternalMergingState) {
			@SuppressWarnings("unchecked")
			InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
			mergingState.mergeNamespaces(window, mergedWindows);
		}
		else {
			throw new IllegalArgumentException(
					"The given state descriptor does not refer to a mergeable state (MergingState)");
		}
	}
	catch (Exception e) {
		throw new RuntimeException("Error while merging state.", e);
	}
}
 
Example #3
Source File: WindowOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(
		StateDescriptor<S, ?> stateDescriptor) {
	if (mergedWindows != null && mergedWindows.size() > 0) {
		try {
			State state =
					WindowOperator.this.getOrCreateKeyedState(
							windowSerializer,
							stateDescriptor);
			if (state instanceof InternalMergingState) {
				((InternalMergingState<K, W, ?, ?, ?>) state).mergeNamespaces(window, mergedWindows);
			} else {
				throw new IllegalArgumentException(
						"The given state descriptor does not refer to a mergeable state (MergingState)");
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Error while merging state.", e);
		}
	}
}
 
Example #4
Source File: WindowOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	if (mergedWindows != null && mergedWindows.size() > 0) {
		try {
			S rawState = getKeyedStateBackend().getOrCreateKeyedState(windowSerializer, stateDescriptor);

			if (rawState instanceof InternalMergingState) {
				@SuppressWarnings("unchecked")
				InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
				mergingState.mergeNamespaces(window, mergedWindows);
			}
			else {
				throw new IllegalArgumentException(
						"The given state descriptor does not refer to a mergeable state (MergingState)");
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Error while merging state.", e);
		}
	}
}
 
Example #5
Source File: TriggerTestHarness.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	try {
		S rawState = stateBackend.getOrCreateKeyedState(windowSerializer, stateDescriptor);

		if (rawState instanceof InternalMergingState) {
			@SuppressWarnings("unchecked")
			InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
			mergingState.mergeNamespaces(window, mergedWindows);
		}
		else {
			throw new IllegalArgumentException(
					"The given state descriptor does not refer to a mergeable state (MergingState)");
		}
	}
	catch (Exception e) {
		throw new RuntimeException("Error while merging state.", e);
	}
}
 
Example #6
Source File: WindowOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(
		StateDescriptor<S, ?> stateDescriptor) {
	if (mergedWindows != null && mergedWindows.size() > 0) {
		try {
			State state =
					WindowOperator.this.getOrCreateKeyedState(
							windowSerializer,
							stateDescriptor);
			if (state instanceof InternalMergingState) {
				((InternalMergingState<K, W, ?, ?, ?>) state).mergeNamespaces(window, mergedWindows);
			} else {
				throw new IllegalArgumentException(
						"The given state descriptor does not refer to a mergeable state (MergingState)");
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Error while merging state.", e);
		}
	}
}
 
Example #7
Source File: WindowOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	if (mergedWindows != null && mergedWindows.size() > 0) {
		try {
			S rawState = getKeyedStateBackend().getOrCreateKeyedState(windowSerializer, stateDescriptor);

			if (rawState instanceof InternalMergingState) {
				@SuppressWarnings("unchecked")
				InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
				mergingState.mergeNamespaces(window, mergedWindows);
			}
			else {
				throw new IllegalArgumentException(
						"The given state descriptor does not refer to a mergeable state (MergingState)");
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Error while merging state.", e);
		}
	}
}
 
Example #8
Source File: TriggerTestHarness.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public <S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor) {
	try {
		S rawState = stateBackend.getOrCreateKeyedState(windowSerializer, stateDescriptor);

		if (rawState instanceof InternalMergingState) {
			@SuppressWarnings("unchecked")
			InternalMergingState<K, W, ?, ?, ?> mergingState = (InternalMergingState<K, W, ?, ?, ?>) rawState;
			mergingState.mergeNamespaces(window, mergedWindows);
		}
		else {
			throw new IllegalArgumentException(
					"The given state descriptor does not refer to a mergeable state (MergingState)");
		}
	}
	catch (Exception e) {
		throw new RuntimeException("Error while merging state.", e);
	}
}
 
Example #9
Source File: Trigger.java    From Flink-CEPplus with Apache License 2.0 votes vote down vote up
<S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor); 
Example #10
Source File: Trigger.java    From flink with Apache License 2.0 votes vote down vote up
<S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor); 
Example #11
Source File: Trigger.java    From flink with Apache License 2.0 votes vote down vote up
<S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor); 
Example #12
Source File: Trigger.java    From flink with Apache License 2.0 votes vote down vote up
<S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor); 
Example #13
Source File: Trigger.java    From flink with Apache License 2.0 votes vote down vote up
<S extends MergingState<?, ?>> void mergePartitionedState(StateDescriptor<S, ?> stateDescriptor);