org.apache.flink.api.common.operators.util.FieldSet.contains()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.flink.api.common.operators.util.FieldSet.contains()方法的一些代码示例,展示了FieldSet.contains()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FieldSet.contains()方法的具体详情如下:
包路径:org.apache.flink.api.common.operators.util.FieldSet
类名称:FieldSet
方法名:contains

FieldSet.contains介绍

暂无

代码示例

代码示例来源:origin: apache/flink

private boolean isTargetFieldPresent(int targetField) {
  for(FieldSet targetFields : fieldMapping.values()) {
    if(targetFields.contains(targetField)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: apache/flink

private boolean isTargetFieldPresent(int targetField, Map<Integer, FieldSet> fieldMapping) {
  for(FieldSet targetFields : fieldMapping.values()) {
    if(targetFields.contains(targetField)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: apache/flink

@Override
public int getForwardingSourceField(int input, int targetField) {
  if (input != 0) {
    throw new IndexOutOfBoundsException();
  }
  for (Map.Entry<Integer, FieldSet> e : fieldMapping.entrySet()) {
    if (e.getValue().contains(targetField)) {
      return e.getKey();
    }
  }
  return -1;
}

代码示例来源:origin: apache/flink

public boolean isValidUnorderedPrefix(FieldSet set) {
  if (set.size() > size()) {
    return false;
  }
  
  List<Integer> list = get();
  for (int i = 0; i < set.size(); i++) {
    if (!set.contains(list.get(i))) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: apache/flink

public boolean groupsFields(FieldSet fields) {
  if (fields.size() > this.indexes.size()) {
    return false;
  }
  
  for (int i = 0; i < fields.size(); i++) {
    if (!fields.contains(this.indexes.get(i))) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@Test
public void testForwardedNoArrowSpaces() {
  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));
}

代码示例来源:origin: apache/flink

@Test
public void testForwardedNoArrowIndividualStrings() {
  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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@Test
public void testGetReadSet() {
  SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
  sp.addReadFields(new FieldSet(0, 1));
  assertEquals(2, sp.getReadFields(0).size());
  assertTrue(sp.getReadFields(0).contains(0));
  assertTrue(sp.getReadFields(0).contains(1));
  sp.addReadFields(new FieldSet(3));
  assertEquals(3, sp.getReadFields(0).size());
  assertTrue(sp.getReadFields(0).contains(0));
  assertTrue(sp.getReadFields(0).contains(1));
  assertTrue(sp.getReadFields(0).contains(3));
}

代码示例来源:origin: apache/flink

@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);
}

代码示例来源:origin: apache/flink

@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));
}

代码示例来源:origin: apache/flink

@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);
}

代码示例来源:origin: apache/flink

@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);
}

相关文章