private static void parseReadFields(String[] rf, SingleInputSemanticProperties sm, TypeInformation<?> inType, TypeInformation<?> outType) { if (rf == null) { return; } for (String str : rf) { if (str != null) { FieldSet fs = readFieldSetFromString(str, inType, outType); sm.addReadFields(fs); } } }
public SingleInputSemanticProperties() { super(); this.init(); }
SingleInputSemanticProperties semanticProperties = new SingleInputSemanticProperties(); semanticProperties.addForwardedField(value,value);
public static SingleInputSemanticProperties getSemanticPropsSingleFromString(String[] constantSet, String[] constantSetExcept, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType) { SingleInputSemanticProperties result = new SingleInputSemanticProperties(); parseConstantFields(constantSet, result, inType, outType); parseConstantFieldsExcept(constantSetExcept, result, inType, outType); parseReadFields(readSet, result, inType, outType); return result; }
private static void parseConstantFieldsExcept(String[] cfe, SingleInputSemanticProperties sm, TypeInformation<?> inType, TypeInformation<?> outType) { if (cfe == null) { return; } for (String str : cfe) { if (str != null) { FieldSet fs = readFieldSetFromString(str, inType, outType); for (int i = 0; i < outType.getArity(); i++) { if (!fs.contains(i)) { sm.addForwardedField(i, i); } } } } }
@Override public boolean isFieldConstant(int input, int fieldNumber) { if (input != 0) { throw new IndexOutOfBoundsException(); } SingleInputOperator<?, ?, ?> c = getPactContract(); SingleInputSemanticProperties semanticProperties = c.getSemanticProperties(); if (semanticProperties != null) { FieldSet fs; if ((fs = semanticProperties.getForwardedField(fieldNumber)) != null) { return fs.contains(fieldNumber); } } return false; }
SingleInputSemanticProperties props = new SingleInputSemanticProperties(); props.addForwardedField(keyField, keyField);
public static SingleInputSemanticProperties getSemanticPropsSingle(Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType) { if (set == null) { return null; } Iterator<Annotation> it = set.iterator(); SingleInputSemanticProperties result = null; //non tuple types are not yet supported for annotations if (!inType.isTupleType() || !outType.isTupleType()) { return null; } while (it.hasNext()) { if (result == null) { result = new SingleInputSemanticProperties(); } Annotation ann = it.next(); if (ann instanceof ConstantFields) { ConstantFields cf = (ConstantFields) ann; parseConstantFields(cf.value(), result, inType, outType); } else if (ann instanceof ConstantFieldsExcept) { ConstantFieldsExcept cfe = (ConstantFieldsExcept) ann; parseConstantFieldsExcept(cfe.value(), result, inType, outType); } else if (ann instanceof ReadFields) { ReadFields rf = (ReadFields) ann; parseReadFields(rf.value(), result, inType, outType); } } return result; }
if (sp instanceof SingleInputSemanticProperties) { for (int i = 0; i < inType.getArity() && i < outType.getArity(); i++) { ((SingleInputSemanticProperties) sp).addForwardedField(i, i); if (sp instanceof SingleInputSemanticProperties) { for (int i = 0; i < outType.getArity(); i++) { ((SingleInputSemanticProperties) sp).addForwardedField(sourceField, i); ((SingleInputSemanticProperties) sp).addForwardedField(sourceField, fs); } else if (sp instanceof DualInputSemanticProperties) { if (input == 0) { for (int i : fs) { if (sp instanceof SingleInputSemanticProperties) { ((SingleInputSemanticProperties) sp).addForwardedField(i, i); } else if (sp instanceof DualInputSemanticProperties) { if (input == 0) {
@Override public boolean isFieldConstant(int input, int fieldNumber) { if (input != 0) { throw new IndexOutOfBoundsException(); } SingleInputOperator<?, ?, ?> c = getPactContract(); SingleInputSemanticProperties semanticProperties = c.getSemanticProperties(); if (semanticProperties != null) { FieldSet fs; if ((fs = semanticProperties.getForwardedField(fieldNumber)) != null) { return fs.contains(fieldNumber); } } return false; }
public SingleInputSemanticProperties() { super(); this.init(); }
/** * Clears the object. */ @Override public void clearProperties() { this.init(); super.clearProperties(); }
/** * Clears the object. */ @Override public void clearProperties() { this.init(); super.clearProperties(); }