org.apache.flink.api.java.operators.translation.WrappingFunction Java Examples

The following examples show how to use org.apache.flink.api.java.operators.translation.WrappingFunction. 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: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> void setOutputType(
		Function userFunction,
		TypeInformation<T> outTypeInfo,
		ExecutionConfig executionConfig) {

	Preconditions.checkNotNull(outTypeInfo);
	Preconditions.checkNotNull(executionConfig);

	while (true) {
		if (trySetOutputType(userFunction, outTypeInfo, executionConfig)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}

	}
}
 
Example #2
Source File: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void restoreFunctionState(
		StateInitializationContext context,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);

	while (true) {

		if (tryRestoreFunction(context, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can restore the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #3
Source File: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void snapshotFunctionState(
		StateSnapshotContext context,
		OperatorStateBackend backend,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);
	Preconditions.checkNotNull(backend);

	while (true) {

		if (trySnapshotFunctionState(context, backend, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #4
Source File: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> void setOutputType(
		Function userFunction,
		TypeInformation<T> outTypeInfo,
		ExecutionConfig executionConfig) {

	Preconditions.checkNotNull(outTypeInfo);
	Preconditions.checkNotNull(executionConfig);

	while (true) {
		if (trySetOutputType(userFunction, outTypeInfo, executionConfig)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}

	}
}
 
Example #5
Source File: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void restoreFunctionState(
		StateInitializationContext context,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);

	while (true) {

		if (tryRestoreFunction(context, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can restore the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #6
Source File: StreamingFunctionUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void snapshotFunctionState(
		StateSnapshotContext context,
		OperatorStateBackend backend,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);
	Preconditions.checkNotNull(backend);

	while (true) {

		if (trySnapshotFunctionState(context, backend, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #7
Source File: StreamingFunctionUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static void restoreFunctionState(
		StateInitializationContext context,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);

	while (true) {

		if (tryRestoreFunction(context, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can restore the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #8
Source File: StreamingFunctionUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static void snapshotFunctionState(
		StateSnapshotContext context,
		OperatorStateBackend backend,
		Function userFunction) throws Exception {

	Preconditions.checkNotNull(context);
	Preconditions.checkNotNull(backend);

	while (true) {

		if (trySnapshotFunctionState(context, backend, userFunction)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}
	}
}
 
Example #9
Source File: StreamingFunctionUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> void setOutputType(
		Function userFunction,
		TypeInformation<T> outTypeInfo,
		ExecutionConfig executionConfig) {

	Preconditions.checkNotNull(outTypeInfo);
	Preconditions.checkNotNull(executionConfig);

	while (true) {
		if (trySetOutputType(userFunction, outTypeInfo, executionConfig)) {
			break;
		}

		// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
		if (userFunction instanceof WrappingFunction) {
			userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
		} else {
			break;
		}

	}
}
 
Example #10
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.extractSemanticAnnotationsFromUdf(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.extractSemanticAnnotationsFromUdf(function.getClass());
	}
}
 
Example #11
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsFirstAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsFirstAnnotation(function.getClass());
	}
}
 
Example #12
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsSecondAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsSecondAnnotation(function.getClass());
	}
}
 
Example #13
Source File: JoinOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.extractSemanticAnnotationsFromUdf(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.extractSemanticAnnotationsFromUdf(function.getClass());
	}
}
 
Example #14
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.extractSemanticAnnotationsFromUdf(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.extractSemanticAnnotationsFromUdf(function.getClass());
	}
}
 
Example #15
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsFirstAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsFirstAnnotation(function.getClass());
	}
}
 
Example #16
Source File: JoinOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsSecondAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsSecondAnnotation(function.getClass());
	}
}
 
Example #17
Source File: JoinOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsSecondAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsSecondAnnotation(function.getClass());
	}
}
 
Example #18
Source File: JoinOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

	if (function instanceof DefaultJoin.WrappingFlatJoinFunction) {
		return super.udfWithForwardedFieldsFirstAnnotation(((WrappingFunction<?>) function).getWrappedFunction().getClass());
	} else {
		return super.udfWithForwardedFieldsFirstAnnotation(function.getClass());
	}
}