org.apache.flink.api.java.operators.UnsortedGrouping.getKeys()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(96)

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

UnsortedGrouping.getKeys介绍

暂无

代码示例

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

/**
 * Uses a custom partitioner for the grouping.
 *
 * @param partitioner The custom partitioner.
 * @return The grouping object itself, to allow for method chaining.
 */
public UnsortedGrouping<T> withPartitioner(Partitioner<?> partitioner) {
  Preconditions.checkNotNull(partitioner);
  getKeys().validateCustomPartitioner(partitioner, null);
  this.customPartitioner = partitioner;
  return this;
}

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

/**
 * Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(int, Order)} calls.
 *
 * @param field The Tuple field on which the group is sorted.
 * @param order The Order in which the specified Tuple field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see org.apache.flink.api.java.tuple.Tuple
 * @see Order
 */
public SortedGrouping<T> sortGroup(int field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field index group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

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

/**
 * Sorts Pojos within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(String, Order)} calls.
 *
 * @param field The Tuple or Pojo field on which the group is sorted.
 * @param order The Order in which the specified field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public SortedGrouping<T> sortGroup(String field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field expression group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

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

/**
 * Sorts elements within a group on a key extracted by the specified {@link org.apache.flink.api.java.functions.KeySelector}
 * in the specified {@link Order}.
 *
 * <p>Chaining {@link #sortGroup(KeySelector, Order)} calls is not supported.
 *
 * @param keySelector The KeySelector with which the group is sorted.
 * @param order The Order in which the extracted key is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public <K> SortedGrouping<T> sortGroup(KeySelector<T, K> keySelector, Order order) {
  if (!(this.getKeys() instanceof Keys.SelectorFunctionKeys)) {
    throw new InvalidProgramException("KeySelector group-sorting keys can only be used with KeySelector grouping keys.");
  }
  TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, this.inputDataSet.getType());
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, new Keys.SelectorFunctionKeys<T, K>(keySelector, this.inputDataSet.getType(), keyType), order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

代码示例来源:origin: com.alibaba.blink/flink-java

/**
 * Uses a custom partitioner for the grouping.
 *
 * @param partitioner The custom partitioner.
 * @return The grouping object itself, to allow for method chaining.
 */
public UnsortedGrouping<T> withPartitioner(Partitioner<?> partitioner) {
  Preconditions.checkNotNull(partitioner);
  getKeys().validateCustomPartitioner(partitioner, null);
  this.customPartitioner = partitioner;
  return this;
}

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

/**
 * Uses a custom partitioner for the grouping.
 *
 * @param partitioner The custom partitioner.
 * @return The grouping object itself, to allow for method chaining.
 */
public UnsortedGrouping<T> withPartitioner(Partitioner<?> partitioner) {
  Preconditions.checkNotNull(partitioner);
  getKeys().validateCustomPartitioner(partitioner, null);
  this.customPartitioner = partitioner;
  return this;
}

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

/**
 * Sorts Pojos within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(String, Order)} calls.
 *
 * @param field The Tuple or Pojo field on which the group is sorted.
 * @param order The Order in which the specified field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public SortedGrouping<T> sortGroup(String field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field expression group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

代码示例来源:origin: com.alibaba.blink/flink-java

/**
 * Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(int, Order)} calls.
 *
 * @param field The Tuple field on which the group is sorted.
 * @param order The Order in which the specified Tuple field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see org.apache.flink.api.java.tuple.Tuple
 * @see Order
 */
public SortedGrouping<T> sortGroup(int field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field index group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

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

/**
 * Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(int, Order)} calls.
 *
 * @param field The Tuple field on which the group is sorted.
 * @param order The Order in which the specified Tuple field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see org.apache.flink.api.java.tuple.Tuple
 * @see Order
 */
public SortedGrouping<T> sortGroup(int field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field index group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

代码示例来源:origin: com.alibaba.blink/flink-java

/**
 * Sorts Pojos within a group on the specified field in the specified {@link Order}.
 *
 * <p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
 *
 * <p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(String, Order)} calls.
 *
 * @param field The Tuple or Pojo field on which the group is sorted.
 * @param order The Order in which the specified field is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public SortedGrouping<T> sortGroup(String field, Order order) {
  if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
    throw new InvalidProgramException("KeySelector grouping keys and field expression group-sorting keys cannot be used together.");
  }
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

代码示例来源:origin: com.alibaba.blink/flink-java

/**
 * Sorts elements within a group on a key extracted by the specified {@link org.apache.flink.api.java.functions.KeySelector}
 * in the specified {@link Order}.
 *
 * <p>Chaining {@link #sortGroup(KeySelector, Order)} calls is not supported.
 *
 * @param keySelector The KeySelector with which the group is sorted.
 * @param order The Order in which the extracted key is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public <K> SortedGrouping<T> sortGroup(KeySelector<T, K> keySelector, Order order) {
  if (!(this.getKeys() instanceof Keys.SelectorFunctionKeys)) {
    throw new InvalidProgramException("KeySelector group-sorting keys can only be used with KeySelector grouping keys.");
  }
  TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, this.inputDataSet.getType());
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, new Keys.SelectorFunctionKeys<T, K>(keySelector, this.inputDataSet.getType(), keyType), order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

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

/**
 * Sorts elements within a group on a key extracted by the specified {@link org.apache.flink.api.java.functions.KeySelector}
 * in the specified {@link Order}.
 *
 * <p>Chaining {@link #sortGroup(KeySelector, Order)} calls is not supported.
 *
 * @param keySelector The KeySelector with which the group is sorted.
 * @param order The Order in which the extracted key is sorted.
 * @return A SortedGrouping with specified order of group element.
 *
 * @see Order
 */
public <K> SortedGrouping<T> sortGroup(KeySelector<T, K> keySelector, Order order) {
  if (!(this.getKeys() instanceof Keys.SelectorFunctionKeys)) {
    throw new InvalidProgramException("KeySelector group-sorting keys can only be used with KeySelector grouping keys.");
  }
  TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, this.inputDataSet.getType());
  SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, new Keys.SelectorFunctionKeys<T, K>(keySelector, this.inputDataSet.getType(), keyType), order);
  sg.customPartitioner = getCustomPartitioner();
  return sg;
}

相关文章