org.apache.flink.streaming.runtime.operators.windowing.KeyMap.put()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(92)

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

KeyMap.put介绍

[英]Inserts the given value, mapped under the given key. If the table already contains a value for the key, the value is replaced and returned. If no value is contained, yet, the function returns null.
[中]插入在给定键下映射的给定值。如果表中已包含键的值,则替换并返回该值。如果未包含任何值,则函数返回null。

代码示例

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

map.put(key, value);

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

Integer previous = maps[pos].put(boxed, boxed);
assertNull("Test problem - test does not assign unique maps", previous);

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

Integer put = map.put(i, 2 * i + 1);
assertNull(put);
Integer put = map.put(i, 2 * i);
assertNotNull(put);
assertEquals(2 * i + 1, put.intValue());

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

map.put(i, 2 * i + 1);

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

public void readFromInput(
    final DataInputView input,
    final TypeSerializer<Key> keySerializer,
    final TypeSerializer<Aggregate> aggSerializer) throws IOException {
  validateMagicNumber(BEGIN_OF_STATE_MAGIC_NUMBER, input.readInt());
  int numPanes = input.readInt();
  // read from the past towards the presence
  while (numPanes > 0) {
    validateMagicNumber(BEGIN_OF_PANE_MAGIC_NUMBER, input.readInt());
    KeyMap<Key, Aggregate> pane = (numPanes == 1) ? latestPane : new KeyMap<Key, Aggregate>();
    final int numElementsInPane = input.readInt();
    for (int i = numElementsInPane - 1; i >= 0; i--) {
      Key k = keySerializer.deserialize(input);
      Aggregate a = aggSerializer.deserialize(input);
      pane.put(k, a);
    }
    if (numPanes > 1) {
      previousPanes.addLast(pane);
    }
    numPanes--;
  }
}

相关文章