org.apache.flink.streaming.api.datastream.KeyedStream.clean()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(15.2k)|赞(0)|评价(0)|浏览(125)

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

KeyedStream.clean介绍

暂无

代码示例

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

/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
  TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
      clean(folder), getType(), Utils.getCallLocationName(), true);
  return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}

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

/**
 * Applies the given {@link ProcessFunction} on the input stream, thereby creating a transformed output stream.
 *
 * <p>The function will be called for every element in the input streams and can produce zero
 * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
 * function, this function can also query the time and set timers. When reacting to the firing
 * of set timers the function can directly emit elements and/or register yet more timers.
 *
 * @param processFunction The {@link ProcessFunction} that is called for each element
 *                      in the stream.
 * @param outputType {@link TypeInformation} for the result type of the function.
 *
 * @param <R> The type of elements emitted by the {@code ProcessFunction}.
 *
 * @return The transformed {@link DataStream}.
 *
 * @deprecated Use {@link KeyedStream#process(KeyedProcessFunction, TypeInformation)}
 */
@Deprecated
@Override
@Internal
public <R> SingleOutputStreamOperator<R> process(
    ProcessFunction<T, R> processFunction,
    TypeInformation<R> outputType) {
  LegacyKeyedProcessOperator<KEY, T, R> operator = new LegacyKeyedProcessOperator<>(clean(processFunction));
  return transform("Process", outputType, operator);
}

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

/**
 * Applies the given {@link KeyedProcessFunction} on the input stream, thereby creating a transformed output stream.
 *
 * <p>The function will be called for every element in the input streams and can produce zero
 * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
 * function, this function can also query the time and set timers. When reacting to the firing
 * of set timers the function can directly emit elements and/or register yet more timers.
 *
 * @param keyedProcessFunction The {@link KeyedProcessFunction} that is called for each element in the stream.
 *
 * @param outputType {@link TypeInformation} for the result type of the function.
 *
 * @param <R> The type of elements emitted by the {@code KeyedProcessFunction}.
 *
 * @return The transformed {@link DataStream}.
 */
@Internal
public <R> SingleOutputStreamOperator<R> process(
    KeyedProcessFunction<KEY, T, R> keyedProcessFunction,
    TypeInformation<R> outputType) {
  KeyedProcessOperator<KEY, T, R> operator = new KeyedProcessOperator<>(clean(keyedProcessFunction));
  return transform("KeyedProcess", outputType, operator);
}

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

/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector} and {@link TypeInformation}
 * to partition operator state by key, where the partitioning is defined by a {@link PartitionTransformation}.
 *
 * @param stream
 *            Base stream of data
 * @param partitionTransformation
 *            Function that determines how the keys are distributed to downstream operator(s)
 * @param keySelector
 *            Function to extract keys from the base stream
 * @param keyType
 *            Defines the type of the extracted keys
 */
@Internal
KeyedStream(
  DataStream<T> stream,
  PartitionTransformation<T> partitionTransformation,
  KeySelector<T, KEY> keySelector,
  TypeInformation<KEY> keyType) {
  super(stream.getExecutionEnvironment(), partitionTransformation);
  this.keySelector = clean(keySelector);
  this.keyType = validateKeyType(keyType);
}

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

protected SingleOutputStreamOperator<T> aggregate(AggregationFunction<T> aggregate) {
  StreamGroupedReduce<T> operator = new StreamGroupedReduce<T>(
      clean(aggregate), getType().createSerializer(getExecutionConfig()));
  return transform("Keyed Aggregation", getType(), operator);
}

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

/**
 * Applies a reduce transformation on the grouped data stream grouped on by
 * the given key position. The {@link ReduceFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same reducer.
 *
 * @param reducer
 *            The {@link ReduceFunction} that will be called for every
 *            element of the input values with the same key.
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> reducer) {
  return transform("Keyed Reduce", getType(), new StreamGroupedReduce<T>(
      clean(reducer), getType().createSerializer(getExecutionConfig())));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
  TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
      clean(folder), getType(), Utils.getCallLocationName(), true);
  return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
  TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
      clean(folder), getType(), Utils.getCallLocationName(), true);
  return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
  TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
      clean(folder), getType(), Utils.getCallLocationName(), true);
  return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector} and {@link TypeInformation}
 * to partition operator state by key, where the partitioning is defined by a {@link PartitionTransformation}.
 *
 * @param stream
 *            Base stream of data
 * @param partitionTransformation
 *            Function that determines how the keys are distributed to downstream operator(s)
 * @param keySelector
 *            Function to extract keys from the base stream
 * @param keyType
 *            Defines the type of the extracted keys
 */
@Internal
KeyedStream(
  DataStream<T> stream,
  PartitionTransformation<T> partitionTransformation,
  KeySelector<T, KEY> keySelector,
  TypeInformation<KEY> keyType) {
  super(stream.getExecutionEnvironment(), partitionTransformation);
  this.keySelector = clean(keySelector);
  this.keyType = validateKeyType(keyType);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies the given {@link ProcessFunction} on the input stream, thereby
 * creating a transformed output stream.
 *
 * <p>The function will be called for every element in the input streams and can produce zero
 * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
 * function, this function can also query the time and set timers. When reacting to the firing
 * of set timers the function can directly emit elements and/or register yet more timers.
 *
 * @param processFunction The {@link ProcessFunction} that is called for each element
 *                      in the stream.
 * @param outputType {@link TypeInformation} for the result type of the function.
 *
 * @param <R> The type of elements emitted by the {@code ProcessFunction}.
 *
 * @return The transformed {@link DataStream}.
 */
@Override
@Internal
public <R> SingleOutputStreamOperator<R> process(
    ProcessFunction<T, R> processFunction,
    TypeInformation<R> outputType) {
  KeyedProcessOperator<KEY, T, R> operator =
      new KeyedProcessOperator<>(clean(processFunction));
  return transform("Process", outputType, operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Creates a new {@link KeyedStream} using the given {@link KeySelector} and {@link TypeInformation}
 * to partition operator state by key, where the partitioning is defined by a {@link PartitionTransformation}.
 *
 * @param stream
 *            Base stream of data
 * @param partitionTransformation
 *            Function that determines how the keys are distributed to downstream operator(s)
 * @param keySelector
 *            Function to extract keys from the base stream
 * @param keyType
 *            Defines the type of the extracted keys
 */
@Internal
KeyedStream(
  DataStream<T> stream,
  PartitionTransformation<T> partitionTransformation,
  KeySelector<T, KEY> keySelector,
  TypeInformation<KEY> keyType) {
  super(stream.getExecutionEnvironment(), partitionTransformation);
  this.keySelector = clean(keySelector);
  this.keyType = validateKeyType(keyType);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies the given {@link KeyedProcessFunction} on the input stream, thereby creating a transformed output stream.
 *
 * <p>The function will be called for every element in the input streams and can produce zero
 * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
 * function, this function can also query the time and set timers. When reacting to the firing
 * of set timers the function can directly emit elements and/or register yet more timers.
 *
 * @param keyedProcessFunction The {@link KeyedProcessFunction} that is called for each element in the stream.
 *
 * @param outputType {@link TypeInformation} for the result type of the function.
 *
 * @param <R> The type of elements emitted by the {@code KeyedProcessFunction}.
 *
 * @return The transformed {@link DataStream}.
 */
@Internal
public <R> SingleOutputStreamOperator<R> process(
    KeyedProcessFunction<KEY, T, R> keyedProcessFunction,
    TypeInformation<R> outputType) {
  KeyedProcessOperator<KEY, T, R> operator = new KeyedProcessOperator<>(clean(keyedProcessFunction));
  return transform("KeyedProcess", outputType, operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies the given {@link KeyedProcessFunction} on the input stream, thereby creating a transformed output stream.
 *
 * <p>The function will be called for every element in the input streams and can produce zero
 * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
 * function, this function can also query the time and set timers. When reacting to the firing
 * of set timers the function can directly emit elements and/or register yet more timers.
 *
 * @param keyedProcessFunction The {@link KeyedProcessFunction} that is called for each element in the stream.
 *
 * @param outputType {@link TypeInformation} for the result type of the function.
 *
 * @param <R> The type of elements emitted by the {@code KeyedProcessFunction}.
 *
 * @return The transformed {@link DataStream}.
 */
@Internal
public <R> SingleOutputStreamOperator<R> process(
    KeyedProcessFunction<KEY, T, R> keyedProcessFunction,
    TypeInformation<R> outputType) {
  KeyedProcessOperator<KEY, T, R> operator = new KeyedProcessOperator<>(clean(keyedProcessFunction));
  return transform("KeyedProcess", outputType, operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

protected SingleOutputStreamOperator<T> aggregate(AggregationFunction<T> aggregate) {
  StreamGroupedReduce<T> operator = new StreamGroupedReduce<T>(
      clean(aggregate), getType().createSerializer(getExecutionConfig()));
  return transform("Keyed Aggregation", getType(), operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

protected SingleOutputStreamOperator<T> aggregate(AggregationFunction<T> aggregate) {
  StreamGroupedReduce<T> operator = new StreamGroupedReduce<T>(
      clean(aggregate), getType().createSerializer(getExecutionConfig()));
  return transform("Keyed Aggregation", getType(), operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

protected SingleOutputStreamOperator<T> aggregate(AggregationFunction<T> aggregate) {
  StreamGroupedReduce<T> operator = new StreamGroupedReduce<T>(
      clean(aggregate), getType().createSerializer(getExecutionConfig()));
  return transform("Keyed Aggregation", getType(), operator);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies a reduce transformation on the grouped data stream grouped on by
 * the given key position. The {@link ReduceFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same reducer.
 *
 * @param reducer
 *            The {@link ReduceFunction} that will be called for every
 *            element of the input values with the same key.
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> reducer) {
  return transform("Keyed Reduce", getType(), new StreamGroupedReduce<T>(
      clean(reducer), getType().createSerializer(getExecutionConfig())));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies a reduce transformation on the grouped data stream grouped on by
 * the given key position. The {@link ReduceFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same reducer.
 *
 * @param reducer
 *            The {@link ReduceFunction} that will be called for every
 *            element of the input values with the same key.
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> reducer) {
  return transform("Keyed Reduce", getType(), new StreamGroupedReduce<T>(
      clean(reducer), getType().createSerializer(getExecutionConfig())));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies a reduce transformation on the grouped data stream grouped on by
 * the given key position. The {@link ReduceFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same reducer.
 *
 * @param reducer
 *            The {@link ReduceFunction} that will be called for every
 *            element of the input values with the same key.
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> reducer) {
  return transform("Keyed Reduce", getType(), new StreamGroupedReduce<T>(
      clean(reducer), getType().createSerializer(getExecutionConfig())));
}

相关文章