Package org.apache.flink.api.common.operators

Examples of org.apache.flink.api.common.operators.DualInputSemanticProperties


  @Test
  public void testFieldsExceptDual() {
    String[] constantFieldsFirstExcept = { "1,2" };
    String[] constantFieldsSecond = { "0->1" };

    DualInputSemanticProperties dsp = new DualInputSemanticProperties();
   
    TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
        BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
    SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, constantFieldsSecond,
        constantFieldsFirstExcept, null, null, null, type, type, type);

    FieldSet fs = dsp.getForwardedField1(0);
    Assert.assertTrue(fs.size() == 1);
    Assert.assertTrue(fs.contains(0));

    fs = dsp.getForwardedField1(1);
    Assert.assertTrue(fs == null);

    fs = dsp.getForwardedField1(2);
    Assert.assertTrue(fs == null);

    fs = dsp.getForwardedField2(0);
    Assert.assertTrue(fs.size() == 1);
    Assert.assertTrue(fs.contains(1));
  }
View Full Code Here


  public void testExtractSemantics() {
    try {
      {
        CoGroupOperator coGroupOp = CoGroupOperator.builder(new TestCoGroupFunction(), LongValue.class, 1, 2).build();
       
        DualInputSemanticProperties props = coGroupOp.getSemanticProperties();
        FieldSet fw2 = props.getForwardedField1(2);
        FieldSet fw4 = props.getForwardedField2(4);
       
        assertNotNull(fw2);
        assertNotNull(fw4);
        assertEquals(1, fw2.size());
        assertEquals(1, fw4.size());
        assertTrue(fw2.contains(2));
        assertTrue(fw4.contains(4));
      }
      {
        CoGroupOperator coGroupOp = CoGroupOperator.builder(TestCoGroupFunction.class, LongValue.class, 1, 2).build();
       
        DualInputSemanticProperties props = coGroupOp.getSemanticProperties();
        FieldSet fw2 = props.getForwardedField1(2);
        FieldSet fw4 = props.getForwardedField2(4);
       
        assertNotNull(fw2);
        assertNotNull(fw4);
        assertEquals(1, fw2.size());
        assertEquals(1, fw4.size());
View Full Code Here

      Plan plan = env.createProgramPlan();

      GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
      JoinOperatorBase<?, ?, ?, ?> projectJoinOperator = ((JoinOperatorBase<?, ?, ?, ?>) sink.getInput());

      DualInputSemanticProperties props = projectJoinOperator.getSemanticProperties();

      assertTrue(props.getForwardedField1(2).size() == 1);
      assertTrue(props.getForwardedField1(3).size() == 1);
      assertTrue(props.getForwardedField2(1).size() == 1);
      assertTrue(props.getForwardedField2(4).size() == 1);
      assertTrue(props.getForwardedField1(2).contains(0));
      assertTrue(props.getForwardedField1(3).contains(1));
      assertTrue(props.getForwardedField2(1).contains(2));
      assertTrue(props.getForwardedField2(4).contains(3));
    } catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Exception in test: " + e.getMessage());
    }
View Full Code Here

      Plan plan = env.createProgramPlan();

      GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
      CrossOperatorBase<?, ?, ?, ?> projectCrossOperator = ((CrossOperatorBase<?, ?, ?, ?>) sink.getInput());

      DualInputSemanticProperties props = projectCrossOperator.getSemanticProperties();

      assertTrue(props.getForwardedField1(2).size() == 1);
      assertTrue(props.getForwardedField1(3).size() == 1);
      assertTrue(props.getForwardedField2(1).size() == 1);
      assertTrue(props.getForwardedField2(4).size() == 1);
      assertTrue(props.getForwardedField1(2).contains(0));
      assertTrue(props.getForwardedField1(3).contains(1));
      assertTrue(props.getForwardedField2(1).contains(2));
      assertTrue(props.getForwardedField2(4).contains(3));
    } catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Exception in test: " + e.getMessage());
    }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.operators.DualInputSemanticProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.