org.apache.flink.api.common.operators.SemanticProperties.InvalidSemanticAnnotationException Java Examples
The following examples show how to use
org.apache.flink.api.common.operators.SemanticProperties.InvalidSemanticAnnotationException.
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: SemanticPropUtil.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result, String[] forwarded, String[] nonForwarded, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType, boolean skipIncompatibleTypes) { boolean hasForwardedAnnotation = false; boolean hasNonForwardedAnnotation = false; // check for forwarded annotations if (forwarded != null && forwarded.length > 0) { hasForwardedAnnotation = true; } // check non-forwarded annotations if (nonForwarded != null && nonForwarded.length > 0) { hasNonForwardedAnnotation = true; } if (hasForwardedAnnotation && hasNonForwardedAnnotation) { throw new InvalidSemanticAnnotationException("Either ForwardedFields OR " + "NonForwardedFields annotation permitted, NOT both."); } else if (hasForwardedAnnotation) { parseForwardedFields(result, forwarded, inType, outType, 0, skipIncompatibleTypes); } else if (hasNonForwardedAnnotation) { parseNonForwardedFields(result, nonForwarded, inType, outType, 0, skipIncompatibleTypes); } parseReadFields(result, readSet, inType, 0); }
Example #2
Source File: SemanticPropUtil.java From flink with Apache License 2.0 | 6 votes |
public static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result, String[] forwarded, String[] nonForwarded, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType, boolean skipIncompatibleTypes) { boolean hasForwardedAnnotation = false; boolean hasNonForwardedAnnotation = false; // check for forwarded annotations if (forwarded != null && forwarded.length > 0) { hasForwardedAnnotation = true; } // check non-forwarded annotations if (nonForwarded != null && nonForwarded.length > 0) { hasNonForwardedAnnotation = true; } if (hasForwardedAnnotation && hasNonForwardedAnnotation) { throw new InvalidSemanticAnnotationException("Either ForwardedFields OR " + "NonForwardedFields annotation permitted, NOT both."); } else if (hasForwardedAnnotation) { parseForwardedFields(result, forwarded, inType, outType, 0, skipIncompatibleTypes); } else if (hasNonForwardedAnnotation) { parseNonForwardedFields(result, nonForwarded, inType, outType, 0, skipIncompatibleTypes); } parseReadFields(result, readSet, inType, 0); }
Example #3
Source File: SemanticPropUtil.java From flink with Apache License 2.0 | 6 votes |
public static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result, String[] forwarded, String[] nonForwarded, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType, boolean skipIncompatibleTypes) { boolean hasForwardedAnnotation = false; boolean hasNonForwardedAnnotation = false; // check for forwarded annotations if (forwarded != null && forwarded.length > 0) { hasForwardedAnnotation = true; } // check non-forwarded annotations if (nonForwarded != null && nonForwarded.length > 0) { hasNonForwardedAnnotation = true; } if (hasForwardedAnnotation && hasNonForwardedAnnotation) { throw new InvalidSemanticAnnotationException("Either ForwardedFields OR " + "NonForwardedFields annotation permitted, NOT both."); } else if (hasForwardedAnnotation) { parseForwardedFields(result, forwarded, inType, outType, 0, skipIncompatibleTypes); } else if (hasNonForwardedAnnotation) { parseNonForwardedFields(result, nonForwarded, inType, outType, 0, skipIncompatibleTypes); } parseReadFields(result, readSet, inType, 0); }
Example #4
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNonForwardedFirstCheck() { String[] forwarded = { "1" }; String[] nonForwarded = { "1" }; SemanticPropUtil.getSemanticPropsDualFromString(new DualInputSemanticProperties(), forwarded, null, nonForwarded, null, null, null, threeIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #5
Source File: SemanticPropUtilTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNonForwardedSecondCheck() { String[] forwarded = { "1" }; String[] nonForwarded = { "1" }; SemanticPropUtil.getSemanticPropsDualFromString(new DualInputSemanticProperties(), null, forwarded, null, nonForwarded, null, null, threeIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #6
Source File: SingleInputSemanticPropertiesTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testAddForwardedFieldsTargetTwice() { SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); sp.addForwardedField(0, 2); sp.addForwardedField(1, 2); }
Example #7
Source File: SemanticPropUtil.java From flink with Apache License 2.0 | 5 votes |
public static SingleInputSemanticProperties getSemanticPropsSingle( Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType) { if (set == null) { return null; } Iterator<Annotation> it = set.iterator(); String[] forwarded = null; String[] nonForwarded = null; String[] read = null; while (it.hasNext()) { Annotation ann = it.next(); if (ann instanceof ForwardedFields) { forwarded = ((ForwardedFields) ann).value(); } else if (ann instanceof NonForwardedFields) { nonForwarded = ((NonForwardedFields) ann).value(); } else if (ann instanceof ReadFields) { read = ((ReadFields) ann).value(); } else if (ann instanceof ForwardedFieldsFirst || ann instanceof ForwardedFieldsSecond || ann instanceof NonForwardedFieldsFirst || ann instanceof NonForwardedFieldsSecond || ann instanceof ReadFieldsFirst || ann instanceof ReadFieldsSecond) { throw new InvalidSemanticAnnotationException("Annotation " + ann.getClass() + " invalid for single input function."); } } if (forwarded != null || nonForwarded != null || read != null) { SingleInputSemanticProperties result = new SingleInputSemanticProperties(); getSemanticPropsSingleFromString(result, forwarded, nonForwarded, read, inType, outType); return result; } return null; }
Example #8
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedDualInvalidTypes2() { String[] nonForwardedFieldsSecond = { "f1" }; DualInputSemanticProperties dsp = new DualInputSemanticProperties(); SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, null, null, nonForwardedFieldsSecond, null, null, threeIntTupleType, pojoInTupleType, threeIntTupleType); }
Example #9
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNonForwardedFirstCheck() { String[] forwarded = { "1" }; String[] nonForwarded = { "1" }; SemanticPropUtil.getSemanticPropsDualFromString(new DualInputSemanticProperties(), forwarded, null, nonForwarded, null, null, null, threeIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #10
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNonForwardedSecondCheck() { String[] forwarded = { "1" }; String[] nonForwarded = { "1" }; SemanticPropUtil.getSemanticPropsDualFromString(new DualInputSemanticProperties(), null, forwarded, null, nonForwarded, null, null, threeIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #11
Source File: SingleInputSemanticPropertiesTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testAddForwardedFieldsTargetTwice() { SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); sp.addForwardedField(0, 2); sp.addForwardedField(1, 2); }
Example #12
Source File: SemanticPropUtil.java From flink with Apache License 2.0 | 5 votes |
public static SingleInputSemanticProperties getSemanticPropsSingle( Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType) { if (set == null) { return null; } Iterator<Annotation> it = set.iterator(); String[] forwarded = null; String[] nonForwarded = null; String[] read = null; while (it.hasNext()) { Annotation ann = it.next(); if (ann instanceof ForwardedFields) { forwarded = ((ForwardedFields) ann).value(); } else if (ann instanceof NonForwardedFields) { nonForwarded = ((NonForwardedFields) ann).value(); } else if (ann instanceof ReadFields) { read = ((ReadFields) ann).value(); } else if (ann instanceof ForwardedFieldsFirst || ann instanceof ForwardedFieldsSecond || ann instanceof NonForwardedFieldsFirst || ann instanceof NonForwardedFieldsSecond || ann instanceof ReadFieldsFirst || ann instanceof ReadFieldsSecond) { throw new InvalidSemanticAnnotationException("Annotation " + ann.getClass() + " invalid for single input function."); } } if (forwarded != null || nonForwarded != null || read != null) { SingleInputSemanticProperties result = new SingleInputSemanticProperties(); getSemanticPropsSingleFromString(result, forwarded, nonForwarded, read, inType, outType); return result; } return null; }
Example #13
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedDualInvalidTypes1() { String[] nonForwardedFieldsFirst = { "f1" }; DualInputSemanticProperties dsp = new DualInputSemanticProperties(); SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, null, nonForwardedFieldsFirst, null, null, null, fiveIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #14
Source File: SingleInputSemanticPropertiesTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testAddForwardedFieldsTargetTwice() { SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); sp.addForwardedField(0, 2); sp.addForwardedField(1, 2); }
Example #15
Source File: SemanticPropUtilTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedDualInvalidTypes2() { String[] nonForwardedFieldsSecond = { "f1" }; DualInputSemanticProperties dsp = new DualInputSemanticProperties(); SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, null, null, nonForwardedFieldsSecond, null, null, threeIntTupleType, pojoInTupleType, threeIntTupleType); }
Example #16
Source File: SemanticPropUtilTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedDualInvalidTypes1() { String[] nonForwardedFieldsFirst = { "f1" }; DualInputSemanticProperties dsp = new DualInputSemanticProperties(); SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, null, nonForwardedFieldsFirst, null, null, null, fiveIntTupleType, threeIntTupleType, threeIntTupleType); }
Example #17
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes1() { String[] nonForwardedFields = { "f1; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, nestedPojoType); }
Example #18
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidString() { String[] forwardedFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
Example #19
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes2() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); }
Example #20
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedSameTargetTwice() { String[] forwardedFields = {"f0->f2; f1->f2"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); }
Example #21
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidString() { String[] nonForwardedFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); }
Example #22
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes3() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, pojo2Type); }
Example #23
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidString() { String[] forwardedFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
Example #24
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedForwardMultiFields() { String[] forwardedFields = { "f1->f0,f1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
Example #25
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedForwardWildCard() { String[] forwardedFields = { "f1->*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
Example #26
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes3() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, pojo2Type); }
Example #27
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes2() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); }
Example #28
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes1() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, threeIntTupleType); }
Example #29
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType5() { String[] forwardedFields = {"f0.*->*"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, fiveIntTupleType); }
Example #30
Source File: SemanticPropUtilTest.java From flink with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType4() { String[] forwardedFields = { "int1; string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojo2Type); }