org.apache.flink.api.java.functions.FunctionAnnotation Java Examples

The following examples show how to use org.apache.flink.api.java.functions.FunctionAnnotation. 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: UdfAnalyzerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void compareAnalyzerResultWithAnnotationsDualInputWithKeys(Class<?> baseClass, Class<?> clazz,
	TypeInformation<?> in1Type, TypeInformation<?> in2Type, TypeInformation<?> outType, String[] keys1, String[] keys2) {
	// expected
	final Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(clazz);
	final DualInputSemanticProperties expected = SemanticPropUtil.getSemanticPropsDual(annotations, in1Type,
			in2Type, outType);

	// actual
	final UdfAnalyzer ua = new UdfAnalyzer(baseClass, clazz, "operator", in1Type, in2Type, outType, (keys1 == null) ? null
			: new Keys.ExpressionKeys(keys1, in1Type), (keys2 == null) ? null : new Keys.ExpressionKeys(
					keys2, in2Type), true);
	ua.analyze();
	final DualInputSemanticProperties actual = (DualInputSemanticProperties) ua.getSemanticProperties();

	assertEquals(expected.toString(), actual.toString());
}
 
Example #2
Source File: TwoInputUdfOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsFirst.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsFirst.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #3
Source File: TwoInputUdfOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsSecond.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsSecond.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #4
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsFirst.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsFirst.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #5
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsSecond.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsSecond.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #6
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsFirstAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsFirst.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsFirst.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #7
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected boolean udfWithForwardedFieldsSecondAnnotation(Class<?> udfClass) {

		if (udfClass.getAnnotation(FunctionAnnotation.ForwardedFieldsSecond.class) != null ||
				udfClass.getAnnotation(FunctionAnnotation.NonForwardedFieldsSecond.class) != null) {
			return true;
		} else {
			return false;
		}
	}
 
Example #8
Source File: SingleInputUdfOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType());
}
 
Example #9
Source File: SingleInputUdfOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected boolean udfWithForwardedFieldsAnnotation(Class<?> udfClass) {
	return udfClass.getAnnotation(FunctionAnnotation.ForwardedFields.class) != null ||
			udfClass.getAnnotation(FunctionAnnotation.NonForwardedFields.class) != null;
}
 
Example #10
Source File: TwoInputUdfOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType());
}
 
Example #11
Source File: SingleInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType());
}
 
Example #12
Source File: SingleInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected boolean udfWithForwardedFieldsAnnotation(Class<?> udfClass) {
	return udfClass.getAnnotation(FunctionAnnotation.ForwardedFields.class) != null ||
			udfClass.getAnnotation(FunctionAnnotation.NonForwardedFields.class) != null;
}
 
Example #13
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType());
}
 
Example #14
Source File: SingleInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType());
}
 
Example #15
Source File: SingleInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected boolean udfWithForwardedFieldsAnnotation(Class<?> udfClass) {
	return udfClass.getAnnotation(FunctionAnnotation.ForwardedFields.class) != null ||
			udfClass.getAnnotation(FunctionAnnotation.NonForwardedFields.class) != null;
}
 
Example #16
Source File: TwoInputUdfOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
	Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass);
	return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType());
}