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

x33g5p2x  于2022-01-30 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(117)

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

SingleOutputStreamOperator.getExecutionEnvironment介绍

暂无

代码示例

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

/**
   * Gets the {@link DataStream} that contains the elements that are emitted from an operation
   * into the side output with the given {@link OutputTag}.
   *
   * @see org.apache.flink.streaming.api.functions.ProcessFunction.Context#output(OutputTag, Object)
   */
  public <X> DataStream<X> getSideOutput(OutputTag<X> sideOutputTag) {
    if (wasSplitApplied) {
      throw new UnsupportedOperationException("getSideOutput() and split() may not be called on the same DataStream. " +
        "As a work-around, please add a no-op map function before the split() call.");
    }

    sideOutputTag = clean(requireNonNull(sideOutputTag));

    // make a defensive copy
    sideOutputTag = new OutputTag<X>(sideOutputTag.getId(), sideOutputTag.getTypeInfo());

    TypeInformation<?> type = requestedSideOutputs.get(sideOutputTag);
    if (type != null && !type.equals(sideOutputTag.getTypeInfo())) {
      throw new UnsupportedOperationException("A side output with a matching id was " +
          "already requested with a different type. This is not allowed, side output " +
          "ids need to be unique.");
    }

    requestedSideOutputs.put(sideOutputTag, sideOutputTag.getTypeInfo());

    SideOutputTransformation<X> sideOutputTransformation = new SideOutputTransformation<>(this.getTransformation(), sideOutputTag);
    return new DataStream<>(this.getExecutionEnvironment(), sideOutputTransformation);
  }
}

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

@Override
protected DataStream<T> setConnectionType(StreamPartitioner<T> partitioner) {
  return new SingleOutputStreamOperator<>(this.getExecutionEnvironment(), new PartitionTransformation<>(this.getTransformation(), partitioner));
}

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

/**
   * Gets the {@link DataStream} that contains the elements that are emitted from an operation
   * into the side output with the given {@link OutputTag}.
   *
   * @see org.apache.flink.streaming.api.functions.ProcessFunction.Context#output(OutputTag, Object)
   */
  public <X> DataStream<X> getSideOutput(OutputTag<X> sideOutputTag) {
    if (wasSplitApplied) {
      throw new UnsupportedOperationException("getSideOutput() and split() may not be called on the same DataStream. " +
        "As a work-around, please add a no-op map function before the split() call.");
    }

    sideOutputTag = clean(requireNonNull(sideOutputTag));

    // make a defensive copy
    sideOutputTag = new OutputTag<X>(sideOutputTag.getId(), sideOutputTag.getTypeInfo());

    TypeInformation<?> type = requestedSideOutputs.get(sideOutputTag);
    if (type != null && !type.equals(sideOutputTag.getTypeInfo())) {
      throw new UnsupportedOperationException("A side output with a matching id was " +
          "already requested with a different type. This is not allowed, side output " +
          "ids need to be unique.");
    }

    requestedSideOutputs.put(sideOutputTag, sideOutputTag.getTypeInfo());

    SideOutputTransformation<X> sideOutputTransformation = new SideOutputTransformation<>(this.getTransformation(), sideOutputTag);
    return new DataStream<>(this.getExecutionEnvironment(), sideOutputTransformation);
  }
}

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

/**
   * Gets the {@link DataStream} that contains the elements that are emitted from an operation
   * into the side output with the given {@link OutputTag}.
   *
   * @see org.apache.flink.streaming.api.functions.ProcessFunction.Context#output(OutputTag, Object)
   */
  public <X> DataStream<X> getSideOutput(OutputTag<X> sideOutputTag) {
    if (wasSplitApplied) {
      throw new UnsupportedOperationException("getSideOutput() and split() may not be called on the same DataStream. " +
        "As a work-around, please add a no-op map function before the split() call.");
    }

    sideOutputTag = clean(requireNonNull(sideOutputTag));

    // make a defensive copy
    sideOutputTag = new OutputTag<X>(sideOutputTag.getId(), sideOutputTag.getTypeInfo());

    TypeInformation<?> type = requestedSideOutputs.get(sideOutputTag);
    if (type != null && !type.equals(sideOutputTag.getTypeInfo())) {
      throw new UnsupportedOperationException("A side output with a matching id was " +
          "already requested with a different type. This is not allowed, side output " +
          "ids need to be unique.");
    }

    requestedSideOutputs.put(sideOutputTag, sideOutputTag.getTypeInfo());

    SideOutputTransformation<X> sideOutputTransformation = new SideOutputTransformation<>(this.getTransformation(), sideOutputTag);
    return new DataStream<>(this.getExecutionEnvironment(), sideOutputTransformation);
  }
}

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

/**
   * Gets the {@link DataStream} that contains the elements that are emitted from an operation
   * into the side output with the given {@link OutputTag}.
   *
   * @see org.apache.flink.streaming.api.functions.ProcessFunction.Context#output(OutputTag, Object)
   */
  public <X> DataStream<X> getSideOutput(OutputTag<X> sideOutputTag) {
    sideOutputTag = clean(requireNonNull(sideOutputTag));

    // make a defensive copy
    sideOutputTag = new OutputTag<X>(sideOutputTag.getId(), sideOutputTag.getTypeInfo());

    TypeInformation<?> type = requestedSideOutputs.get(sideOutputTag);
    if (type != null && !type.equals(sideOutputTag.getTypeInfo())) {
      throw new UnsupportedOperationException("A side output with a matching id was " +
          "already requested with a different type. This is not allowed, side output " +
          "ids need to be unique.");
    }

    requestedSideOutputs.put(sideOutputTag, sideOutputTag.getTypeInfo());

    SideOutputTransformation<X> sideOutputTransformation = new SideOutputTransformation<>(this.getTransformation(), sideOutputTag);
    return new DataStream<>(this.getExecutionEnvironment(), sideOutputTransformation);
  }
}

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

/**
 * Applies a flat select function to the detected pattern sequence. For each pattern sequence
 * the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
 * can produce an arbitrary number of resulting elements.
 *
 * @param patternFlatSelectFunction The pattern flat select function which is called for each
 *                                  detected pattern sequence.
 * @param <R> Type of the resulting elements
 * @param outTypeInfo Explicit specification of output type.
 * @return {@link DataStream} which contains the resulting elements from the pattern flat select
 *         function.
 */
public <R> SingleOutputStreamOperator<R> flatSelect(final PatternFlatSelectFunction<T, R> patternFlatSelectFunction, TypeInformation<R> outTypeInfo) {
  SingleOutputStreamOperator<Map<String, List<T>>> patternStream =
      CEPOperatorUtils.createPatternStream(inputStream, pattern);
  return patternStream.flatMap(
    new PatternFlatSelectMapper<>(
      patternStream.getExecutionEnvironment().clean(patternFlatSelectFunction)
    )).returns(outTypeInfo);
}

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

/**
 * Applies a select function to the detected pattern sequence. For each pattern sequence the
 * provided {@link PatternSelectFunction} is called. The pattern select function can produce
 * exactly one resulting element.
 *
 * @param patternSelectFunction The pattern select function which is called for each detected
 *                              pattern sequence.
 * @param <R> Type of the resulting elements
 * @param outTypeInfo Explicit specification of output type.
 * @return {@link DataStream} which contains the resulting elements from the pattern select
 *         function.
 */
public <R> SingleOutputStreamOperator<R> select(final PatternSelectFunction<T, R> patternSelectFunction, TypeInformation<R> outTypeInfo) {
  SingleOutputStreamOperator<Map<String, List<T>>> patternStream =
      CEPOperatorUtils.createPatternStream(inputStream, pattern);
  return patternStream.map(
    new PatternSelectMapper<>(
      patternStream.getExecutionEnvironment().clean(patternSelectFunction)))
    .returns(outTypeInfo);
}

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

patternStream.getExecutionEnvironment().clean(patternSelectFunction),
patternStream.getExecutionEnvironment().clean(patternTimeoutFunction)

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

patternStream.getExecutionEnvironment().clean(patternFlatSelectFunction),
patternStream.getExecutionEnvironment().clean(patternFlatTimeoutFunction)

相关文章

微信公众号

最新文章

更多