protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType()); }
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType()); }
/** * Utility sink function that counts elements and writes the count into an accumulator, * from which it can be retrieved by the client. This sink is used by the * {@link DataSet#count()} function. * * @param <T> Type of elements to count. */ @SkipCodeAnalysis public static class CountHelper<T> extends RichOutputFormat<T> { private static final long serialVersionUID = 1L; private final String id; private long counter; public CountHelper(String id) { this.id = id; this.counter = 0L; } @Override public void configure(Configuration parameters) {} @Override public void open(int taskNumber, int numTasks) {} @Override public void writeRecord(T record) { counter++; } @Override public void close() { getRuntimeContext().getLongCounter(id).add(counter); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void compareAnalyzerResultWithAnnotationsSingleInputWithKeys(Class<?> baseClass, Class<?> clazz, TypeInformation<?> inType, TypeInformation<?> outType, String[] keys) { // expected final Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(clazz); SingleInputSemanticProperties expected = SemanticPropUtil.getSemanticPropsSingle(annotations, inType, outType); if (expected == null) { expected = new SingleInputSemanticProperties(); } // actual final UdfAnalyzer ua = new UdfAnalyzer(baseClass, clazz, "operator", inType, null, outType, (keys == null) ? null : new Keys.ExpressionKeys(keys, inType), null, true); ua.analyze(); final SingleInputSemanticProperties actual = (SingleInputSemanticProperties) ua.getSemanticProperties(); assertEquals(expected.toString(), actual.toString()); }
@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()); }
@SkipCodeAnalysis public static class ChecksumHashCodeHelper<T> extends RichOutputFormat<T> {
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType()); }
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType()); }
@SkipCodeAnalysis public static class CollectHelper<T> extends RichOutputFormat<T> {
protected SingleInputSemanticProperties extractSemanticAnnotations(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readSingleForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType()); }
protected DualInputSemanticProperties extractSemanticAnnotationsFromUdf(Class<?> udfClass) { Set<Annotation> annotations = FunctionAnnotation.readDualForwardAnnotations(udfClass); return SemanticPropUtil.getSemanticPropsDual(annotations, getInput1Type(), getInput2Type(), getResultType()); }
@SkipCodeAnalysis public static class ChecksumHashCodeHelper<T> extends RichOutputFormat<T> {
/** * Utility sink function that counts elements and writes the count into an accumulator, * from which it can be retrieved by the client. This sink is used by the * {@link DataSet#count()} function. * * @param <T> Type of elements to count. */ @SkipCodeAnalysis public static class CountHelper<T> extends RichOutputFormat<T> { private static final long serialVersionUID = 1L; private final String id; private long counter; public CountHelper(String id) { this.id = id; this.counter = 0L; } @Override public void configure(Configuration parameters) {} @Override public void open(int taskNumber, int numTasks) {} @Override public void writeRecord(T record) { counter++; } @Override public void close() { getRuntimeContext().getLongCounter(id).add(counter); } }
@SkipCodeAnalysis public static class ChecksumHashCodeHelper<T> extends RichOutputFormat<T> {
/** * Utility sink function that counts elements and writes the count into an accumulator, * from which it can be retrieved by the client. This sink is used by the * {@link DataSet#count()} function. * * @param <T> Type of elements to count. */ @SkipCodeAnalysis public static class CountHelper<T> extends RichOutputFormat<T> { private static final long serialVersionUID = 1L; private final String id; private long counter; public CountHelper(String id) { this.id = id; this.counter = 0L; } @Override public void configure(Configuration parameters) {} @Override public void open(int taskNumber, int numTasks) {} @Override public void writeRecord(T record) { counter++; } @Override public void close() { getRuntimeContext().getLongCounter(id).add(counter); } }
@SkipCodeAnalysis public static class CollectHelper<T> extends RichOutputFormat<T> {
@SkipCodeAnalysis public static class CollectHelper<T> extends RichOutputFormat<T> {