/// <summary> /// KeyBy()算子底层所采用的StreamPartitioner. /// </summary> /// <param name="record">the stream record.</param> /// <returns>the sub-task id.</returns> public override int SelectChannel(SerializationDelegate <StreamRecord <TElement> > record) { TKey key; try { key = KeySelector.GetKey(record.Instance.Value); } catch (Exception e) { throw new RuntimeException($"Could not extract key from {record.Instance.Value}", e); } return(KeyGroupRangeAssignment.AssignKeyToParallelOperator(key, MaxParallelism, NumberOfChannels)); }