예제 #1
0
    /** Specifies a {@link KeySelector} for elements from the second input. */
    public EqualTo equalTo(KeySelector<T2, KEY> keySelector) {
      TypeInformation<KEY> otherKey =
          TypeExtractor.getKeySelectorTypes(keySelector, input2.getType());
      if (!otherKey.equals(this.keyType)) {
        throw new IllegalArgumentException(
            "The keys for the two inputs are not equal: "
                + "first key = "
                + this.keyType
                + " , second key = "
                + otherKey);
      }

      return new EqualTo(input2.clean(keySelector));
    }
예제 #2
0
 /**
  * Continues a CoGroup transformation and defines a {@link KeySelector} function for the
  * second co-grouped {@link DataSet}.<br>
  * The KeySelector function is called for each element of the second DataSet and extracts a
  * single key value on which the DataSet is grouped. <br>
  *
  * @param keyExtractor The KeySelector function which extracts the key values from the second
  *     DataSet on which it is grouped.
  * @return An incomplete CoGroup transformation. Call {@link
  *     org.apache.flink.api.java.operators.CoGroupOperator.CoGroupOperatorSets.CoGroupOperatorSetsPredicate.CoGroupOperatorWithoutFunction#with(org.apache.flink.api.common.functions.CoGroupFunction)}
  *     to finalize the CoGroup transformation.
  */
 public <K> CoGroupOperatorWithoutFunction equalTo(KeySelector<I2, K> keyExtractor) {
   TypeInformation<K> keyType =
       TypeExtractor.getKeySelectorTypes(keyExtractor, input2.getType());
   return createCoGroupOperator(
       new SelectorFunctionKeys<>(keyExtractor, input2.getType(), keyType));
 }
예제 #3
0
 /**
  * Continues a CoGroup transformation and defines a {@link KeySelector} function for the first
  * co-grouped {@link DataSet}.<br>
  * The KeySelector function is called for each element of the first DataSet and extracts a
  * single key value on which the DataSet is grouped. <br>
  *
  * @param keyExtractor The KeySelector function which extracts the key values from the DataSet
  *     on which it is grouped.
  * @return An incomplete CoGroup transformation. Call {@link
  *     org.apache.flink.api.java.operators.CoGroupOperator.CoGroupOperatorSets.CoGroupOperatorSetsPredicate#equalTo(int...)}
  *     to continue the CoGroup.
  * @see KeySelector
  * @see DataSet
  */
 public <K> CoGroupOperatorSetsPredicate where(KeySelector<I1, K> keyExtractor) {
   TypeInformation<K> keyType =
       TypeExtractor.getKeySelectorTypes(keyExtractor, input1.getType());
   return new CoGroupOperatorSetsPredicate(
       new SelectorFunctionKeys<>(keyExtractor, input1.getType(), keyType));
 }
예제 #4
0
 /** Specifies a {@link KeySelector} for elements from the first input. */
 public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector) {
   TypeInformation<KEY> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
   return new Where<>(input1.clean(keySelector), keyType);
 }