コード例 #1
0
ファイル: Keys.java プロジェクト: icklerly/flink
  /** Check if two sets of keys are compatible to each other (matching types, key counts) */
  public boolean areCompatible(Keys<?> other) throws IncompatibleKeysException {

    TypeInformation<?>[] thisKeyFieldTypes = this.getKeyFieldTypes();
    TypeInformation<?>[] otherKeyFieldTypes = other.getKeyFieldTypes();

    if (thisKeyFieldTypes.length != otherKeyFieldTypes.length) {
      throw new IncompatibleKeysException(IncompatibleKeysException.SIZE_MISMATCH_MESSAGE);
    } else {
      for (int i = 0; i < thisKeyFieldTypes.length; i++) {
        if (!thisKeyFieldTypes[i].equals(otherKeyFieldTypes[i])) {
          throw new IncompatibleKeysException(thisKeyFieldTypes[i], otherKeyFieldTypes[i]);
        }
      }
    }
    return true;
  }