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

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

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

KeyedStream.getKeyType介绍

[英]Gets the type of the key by which the stream is partitioned.
[中]获取用于对流进行分区的键的类型。

代码示例

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

/**
 * Publishes the keyed stream as a queryable FoldingState instance.
 *
 * @param queryableStateName Name under which to the publish the queryable state instance
 * @param stateDescriptor State descriptor to create state instance from
 * @return Queryable state instance
 *
 * @deprecated will be removed in a future version
 */
@PublicEvolving
@Deprecated
public <ACC> QueryableStateStream<KEY, ACC> asQueryableState(
    String queryableStateName,
    FoldingStateDescriptor<T, ACC> stateDescriptor) {
  transform("Queryable state: " + queryableStateName,
      getType(),
      new QueryableAppendingStateOperator<>(queryableStateName, stateDescriptor));
  stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
  return new QueryableStateStream<>(
      queryableStateName,
      stateDescriptor,
      getKeyType().createSerializer(getExecutionConfig()));
}

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

KeyedStream<IN2, ?> keyedInput2 = (KeyedStream<IN2, ?>) inputStream2;
TypeInformation<?> keyType1 = keyedInput1.getKeyType();
TypeInformation<?> keyType2 = keyedInput2.getKeyType();
if (!(keyType1.canEqual(keyType2) && keyType1.equals(keyType2))) {
  throw new UnsupportedOperationException("Key types if input KeyedStreams " +

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

/**
 * Publishes the keyed stream as a queryable ReducingState instance.
 *
 * @param queryableStateName Name under which to the publish the queryable state instance
 * @param stateDescriptor State descriptor to create state instance from
 * @return Queryable state instance
 */
@PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
    String queryableStateName,
    ReducingStateDescriptor<T> stateDescriptor) {
  transform("Queryable state: " + queryableStateName,
      getType(),
      new QueryableAppendingStateOperator<>(queryableStateName, stateDescriptor));
  stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
  return new QueryableStateStream<>(
      queryableStateName,
      stateDescriptor,
      getKeyType().createSerializer(getExecutionConfig()));
}

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

/**
 * Publishes the keyed stream as a queryable ValueState instance.
 *
 * @param queryableStateName Name under which to the publish the queryable state instance
 * @param stateDescriptor State descriptor to create state instance from
 * @return Queryable state instance
 */
@PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
    String queryableStateName,
    ValueStateDescriptor<T> stateDescriptor) {
  transform("Queryable state: " + queryableStateName,
      getType(),
      new QueryableValueStateOperator<>(queryableStateName, stateDescriptor));
  stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
  return new QueryableStateStream<>(
      queryableStateName,
      stateDescriptor,
      getKeyType().createSerializer(getExecutionConfig()));
}

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new FoldApplyWindowFunction<>(initialValue, foldFunction, function, foldAccumulatorType)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(function),

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

@Internal
private <OUT> SingleOutputStreamOperator<OUT> transform(
    final String functionName,
    final TypeInformation<OUT> outTypeInfo,
    final TwoInputStreamOperator<IN1, IN2, OUT> operator) {
  // read the output type of the input Transforms to coax out errors about MissingTypeInfo
  inputStream1.getType();
  inputStream2.getType();
  TwoInputTransformation<IN1, IN2, OUT> transform = new TwoInputTransformation<>(
      inputStream1.getTransformation(),
      inputStream2.getTransformation(),
      functionName,
      operator,
      outTypeInfo,
      environment.getParallelism());
  if (inputStream1 instanceof KeyedStream) {
    KeyedStream<IN1, ?> keyedInput1 = (KeyedStream<IN1, ?>) inputStream1;
    TypeInformation<?> keyType1 = keyedInput1.getKeyType();
    transform.setStateKeySelectors(keyedInput1.getKeySelector(), null);
    transform.setStateKeyType(keyType1);
  }
  @SuppressWarnings({ "unchecked", "rawtypes" })
  SingleOutputStreamOperator<OUT> returnStream = new SingleOutputStreamOperator(environment, transform);
  getExecutionEnvironment().addOperator(transform);
  return returnStream;
}

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new FoldApplyWindowFunction<>(initialValue, foldFunction, function, resultType)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
function,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
function,

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableAllWindowFunction<>(new FoldApplyAllWindowFunction<>(initialValue, foldFunction, function, resultType)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueAllWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessWindowFunction<>(new FoldApplyProcessWindowFunction<>(initialValue, foldFunction, windowFunction, foldResultType)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessWindowFunction<>(windowFunction),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessAllWindowFunction<>(new FoldApplyProcessAllWindowFunction<>(initialValue, foldFunction, function, foldAccumulatorType)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessAllWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
function,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
function,

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new ReduceApplyWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableAllWindowFunction<>(new ReduceApplyAllWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueAllWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new ReduceApplyWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessWindowFunction<>(new ReduceApplyProcessWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessAllWindowFunction<>(new ReduceApplyProcessAllWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessAllWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableAllWindowFunction<>(new ReduceApplyAllWindowFunction<>(reduceFunction, function)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueAllWindowFunction<>(function),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalAggregateProcessAllWindowFunction<>(aggregateFunction, windowFunction),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessAllWindowFunction<>(windowFunction),

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

windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new AggregateApplyWindowFunction<>(aggregateFunction, windowFunction)),
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(windowFunction),

相关文章