SemanticPropUtil { public static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result, String[] forwarded, String[] nonForwarded, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType) { getSemanticPropsSingleFromString(result, forwarded, nonForwarded, readSet, inType, outType, false); } private  SemanticPropUtil(); static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType); static DualInputSemanticProperties createProjectionPropertiesDual(
			int[] fields, boolean[] isFromFirst, TypeInformation<?> inType1, TypeInformation<?> inType2); static SingleInputSemanticProperties addSourceFieldOffset(SingleInputSemanticProperties props,
																		int numInputFields, int offset); static DualInputSemanticProperties addSourceFieldOffsets(DualInputSemanticProperties props,
																	int numInputFields1, int numInputFields2,
																	int offset1, int offset2); static SingleInputSemanticProperties getSemanticPropsSingle(
			Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType); static DualInputSemanticProperties getSemanticPropsDual(
			Set<Annotation> set, TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType); static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result,
														String[] forwarded, String[] nonForwarded, String[] readSet,
														TypeInformation<?> inType, TypeInformation<?> outType); static void getSemanticPropsSingleFromString(SingleInputSemanticProperties result,
			String[] forwarded, String[] nonForwarded, String[] readSet,
			TypeInformation<?> inType, TypeInformation<?> outType,
			boolean skipIncompatibleTypes); static void getSemanticPropsDualFromString(DualInputSemanticProperties result,
			String[] forwardedFirst, String[] forwardedSecond,
			String[] nonForwardedFirst, String[] nonForwardedSecond, String[]
			readFieldsFirst, String[] readFieldsSecond,
			TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType); static void getSemanticPropsDualFromString(DualInputSemanticProperties result,
			String[] forwardedFirst, String[] forwardedSecond,
			String[] nonForwardedFirst, String[] nonForwardedSecond, String[]
			readFieldsFirst, String[] readFieldsSecond,
			TypeInformation<?> inType1, TypeInformation<?> inType2, TypeInformation<?> outType,
			boolean skipIncompatibleTypes);  }
@Test public void testForwardedNoArrrowIndividualStrings() { String[] forwardedFields = {"f2","f3","f0"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); }
@Test public void testForwardedNoArrrowOneString() { String[] forwardedFields = {"f2;f3;f0"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); forwardedFields[0] = "2;3;0"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); forwardedFields[0] = "2;3;0;"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); }
@Test public void testForwardedNoArrrowSpaces() { String[] forwardedFields = {" f2 ; f3 ; f0 "}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); }
@Test public void testForwardedWithArrowIndividualStrings() { String[] forwardedFields = { "f0->f1", "f1->f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); }
@Test public void testForwardedWithArrowOneString() { String[] forwardedFields = { "f0->f0;f1->f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); forwardedFields[0] = "0->0;1->2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); }
@Test public void testForwardedWithArrowSpaces() { String[] forwardedFields = { " f0 -> f0 ; f1 -> f2 " }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); }
@Test public void testForwardedMixedOneString() { String[] forwardedFields = {"f2;f3;f0->f4;f4->f0"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(0)); }
@Test public void testForwardedBasicType() { String[] forwardedFields = {"f1->*"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, intType); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); forwardedFields[0] = "*->f2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, intType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(2)); forwardedFields[0] = "*->*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, intType, intType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); }
@Test public void testForwardedWildCard() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); forwardedFields[0] = "*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); }
@Test public void testForwardedNestedTuples() { String[] forwardedFields = { "f0->f0.f0; f1->f0.f1; f2->f0.f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); forwardedFields[0] = "f0.f0->f1.f0.f2; f0.f1->f2; f2->f1.f2; f1->f0"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(6)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(0)); forwardedFields[0] = "0.0->1.0.2; 0.1->2; 2->1.2; 1->0"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(6)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(0)); forwardedFields[0] = "f1.f0.*->f0.*; f0->f2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(4)); forwardedFields[0] = "1.0.*->0.*; 0->2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(4)); forwardedFields[0] = "f1.f0->f0; f0->f2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(4)); forwardedFields[0] = "1.0->0; 0->2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 0).contains(4)); forwardedFields[0] = "f1.f0.f1; f1.f1; f2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 6).contains(6)); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); forwardedFields[0] = "f1.f0.*; f1.f2"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 4).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 6).size() == 0); }
@Test public void testForwardedPojo() { String[] forwardedFields = { "int1->int2; int3->int1; string1 " }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); forwardedFields[0] = "f1->int1; f0->int3 "; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); forwardedFields[0] = "int1->f2; int2->f0; int3->f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(1)); forwardedFields[0] = "*->pojo1.*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(4)); forwardedFields[0] = "*->pojo1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(4)); forwardedFields[0] = "int1; string1; int2->pojo1.int3"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).contains(5)); forwardedFields[0] = "pojo1.*->f2.*; int1->f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedPojoType, pojoInTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(5)); forwardedFields[0] = "f2.*->*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 2).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(3)); forwardedFields[0] = "pojo1->f2; int1->f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedPojoType, pojoInTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(5)); forwardedFields[0] = "f2->*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 2).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(3)); forwardedFields[0] = "int2; string1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); forwardedFields[0] = "pojo1.int1; string1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedPojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 5).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 4).size() == 0); forwardedFields[0] = "pojo1.*; int1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedPojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); forwardedFields[0] = "pojo1; int1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedPojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testInvalidPojoField() { String[] forwardedFields = { "invalidField" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNoArrowOneStringInvalidDelimiter() { String[] forwardedFields = {"f2,f3,f0"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType); }
@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); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType1() { String[] forwardedFields = {"f0->f0","f1->f2"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, threeMixedTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType2() { String[] forwardedFields = { "f2.*->*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojo2Type); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType3() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojo2Type); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType4() { String[] forwardedFields = { "int1; string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoInTupleType, pojo2Type); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidTargetFieldType5() { String[] forwardedFields = {"f0.*->*"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, fiveIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes1() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes2() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedWildCardInvalidTypes3() { String[] forwardedFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, pojoType, pojo2Type); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedForwardWildCard() { String[] forwardedFields = { "f1->*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidExpression() { String[] forwardedFields = { "f0" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, intType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedForwardMultiFields() { String[] forwardedFields = { "f1->f0,f1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedInvalidString() { String[] forwardedFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType); }
@Test public void testNonForwardedIndividualStrings() { String[] nonForwardedFields = { "f1", "f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); }
@Test public void testNonForwardedSingleString() { String[] nonForwardedFields = { "f1;f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); nonForwardedFields[0] = "f1;f2;"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); }
@Test public void testNonForwardedSpaces() { String[] nonForwardedFields = { " f1 ; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); }
@Test public void testNonForwardedNone() { String[] nonForwardedFields = { "" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); }
@Test public void testNonForwardedNestedTuple() { String[] nonForwardedFields = {"f1.f0.*; f1.f2; f0"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 6).contains(6)); nonForwardedFields[0] = "f1.f0; f1.f2; f0"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 6).contains(6)); nonForwardedFields[0] = "f2; f1.f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, deepNestedTupleType, deepNestedTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 4).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 5).contains(5)); assertTrue(sp.getForwardingTargetFields(0, 6).size() == 0); }
@Test public void testNonForwardedPojo() { String[] nonForwardedFields = { "int1; string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, pojoType, pojoType); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).contains(2)); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); }
@Test public void testNonForwardedNestedPojo() { String[] nonForwardedFields = { "int1; pojo1.*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, nestedPojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 4).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 5).contains(5)); nonForwardedFields[0] = "pojo1.int2; string1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, nestedPojoType, nestedPojoType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(1)); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 3).contains(3)); assertTrue(sp.getForwardingTargetFields(0, 4).contains(4)); assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes1() { String[] nonForwardedFields = { "f1; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, nestedPojoType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes2() { String[] nonForwardedFields = { "f1; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, nestedPojoType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes3() { String[] nonForwardedFields = { "f1; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, fiveIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes4() { String[] nonForwardedFields = { "f1; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, fiveIntTupleType, threeIntTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidTypes5() { String[] nonForwardedFields = { "int1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, pojoType, pojo2Type); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidNesting() { String[] nonForwardedFields = { "f0.f4" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, nestedTupleType, nestedTupleType); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testNonForwardedInvalidString() { String[] nonForwardedFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType); }
@Test public void testReadFieldsIndividualStrings() { String[] readFields = { "f1", "f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 2); assertTrue(fs.contains(2)); assertTrue(fs.contains(1)); }
@Test public void testReadFieldsOneString() { String[] readFields = { "f1;f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 2); assertTrue(fs.contains(2)); assertTrue(fs.contains(1)); readFields[0] = "f1;f2;"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType); fs = sp.getReadFields(0); assertTrue(fs.size() == 2); assertTrue(fs.contains(2)); assertTrue(fs.contains(1)); }
@Test public void testReadFieldsSpaces() { String[] readFields = { " f1 ; f2 " }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 2); assertTrue(fs.contains(2)); assertTrue(fs.contains(1)); }
@Test public void testReadFieldsBasic() { String[] readFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, intType, intType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 1); assertTrue(fs.contains(0)); sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, intType, fiveIntTupleType); fs = sp.getReadFields(0); assertTrue(fs.size() == 1); assertTrue(fs.contains(0)); }
@Test public void testReadFieldsNestedTuples() { String[] readFields = { "f0.f1; f0.f2; f2" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedTupleType, intType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 3); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(4)); readFields[0] = "f0;f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedTupleType, intType); fs = sp.getReadFields(0); assertTrue(fs.size() == 4); assertTrue(fs.contains(0)); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); }
@Test public void testReadFieldsNestedTupleWildCard() { String[] readFields = { "*" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedTupleType, intType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 5); assertTrue(fs.contains(0)); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); assertTrue(fs.contains(4)); readFields[0] = "f0.*;f1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedTupleType, intType); fs = sp.getReadFields(0); assertTrue(fs.size() == 4); assertTrue(fs.contains(0)); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); }
@Test public void testReadFieldsPojo() { String[] readFields = { "int2; string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, pojoType, threeIntTupleType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 2); assertTrue(fs.contains(1)); assertTrue(fs.contains(3)); readFields[0] = "*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, pojoType, intType); fs = sp.getReadFields(0); assertTrue(fs.size() == 4); assertTrue(fs.contains(0)); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); }
@Test public void testReadFieldsNestedPojo() { String[] readFields = { "pojo1.int2; string1; pojo1.string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 3); assertTrue(fs.contains(2)); assertTrue(fs.contains(4)); assertTrue(fs.contains(5)); readFields[0] = "pojo1.*"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType); fs = sp.getReadFields(0); assertTrue(fs.size() == 4); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); assertTrue(fs.contains(4)); readFields[0] = "pojo1"; sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType); fs = sp.getReadFields(0); assertTrue(fs.size() == 4); assertTrue(fs.contains(1)); assertTrue(fs.contains(2)); assertTrue(fs.contains(3)); assertTrue(fs.contains(4)); }
@Test public void testReadFieldsPojoInTuple() { String[] readFields = { "f0; f2.int1; f2.string1" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, pojoInTupleType, pojo2Type); FieldSet fs = sp.getReadFields(0); assertTrue(fs.size() == 3); assertTrue(fs.contains(0)); assertTrue(fs.contains(2)); assertTrue(fs.contains(5)); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testReadFieldsInvalidString() { String[] readFields = { "notValid" }; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType); }
@Test public void testForwardedRead() { String[] forwardedFields = { "f0->f0;f1->f2" }; String[] readFields = {"f0; f2"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, readFields, threeIntTupleType, fiveIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).contains(2)); assertTrue(sp.getReadFields(0).size() == 2); assertTrue(sp.getReadFields(0).contains(0)); assertTrue(sp.getReadFields(0).contains(2)); }
@Test public void testNonForwardedRead() { String[] nonForwardedFields = { "f1;f2" }; String[] readFields = {"f0; f2"}; SingleInputSemanticProperties sp = new SingleInputSemanticProperties(); SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, readFields, threeIntTupleType, threeIntTupleType); assertTrue(sp.getForwardingTargetFields(0, 0).contains(0)); assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0); assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0); assertTrue(sp.getReadFields(0).size() == 2); assertTrue(sp.getReadFields(0).contains(0)); assertTrue(sp.getReadFields(0).contains(2)); }
@Test(expected = InvalidSemanticAnnotationException.class) public void testForwardedNonForwardedCheck() { String[] forwarded = { "1" }; String[] nonForwarded = { "1" }; SemanticPropUtil.getSemanticPropsSingleFromString(new SingleInputSemanticProperties(), forwarded, nonForwarded, null, threeIntTupleType, threeIntTupleType); }