You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sebastian Schelter (JIRA)" <ji...@apache.org> on 2014/11/19 15:24:34 UTC
[jira] [Created] (FLINK-1255) Problems with generic types in Scala
API
Sebastian Schelter created FLINK-1255:
-----------------------------------------
Summary: Problems with generic types in Scala API
Key: FLINK-1255
URL: https://issues.apache.org/jira/browse/FLINK-1255
Project: Flink
Issue Type: Bug
Components: Scala API
Affects Versions: 0.7.0-incubating
Reporter: Sebastian Schelter
the code below produces the following exception:
{noformat}
Error:(47, 18) could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[K]
data.groupBy { extractKey }
{noformat}
Fixing K to Long made the code run though
{noformat}
def groupCount[T, K](data: DataSet[T], extractKey: (T) => K): DataSet[(K, Long)] = {
data.groupBy { extractKey }
.reduceGroup { group => countBy(extractKey, group) }
}
private[this] def countBy[T, K](extractKey: T => K,
group: Iterator[T]): (K, Long) = {
val key = extractKey(group.next())
var count = 1L
while (group.hasNext) {
group.next()
count += 1
}
key -> count
}
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)