[英]Getting unspecified value parameter scala Kafka
Hi I am getting this compilation error - 嗨,我收到此编译错误-
Unspecified Value parameters: aggregator: (String, String, NotInferedVR) => NotInferedVR
But I clearly have an aggregator there already. 但是我显然已经在那里有了一个聚合器。 Does anyone know what's going on?
有人知道发生了什么吗?
val stream = builder
.stream(inputTopic)(Consumed.`with`(Serdes.String(), Serdes.ByteArray()))
.map{ (key: String, value: Array[Byte]) =>
println(s"key = ${key}")
val lv = GroupByAction.convertByteArrayToJsonObject(value)
val lst = List.empty[String]
val newKey = GroupByAction
.reKey(lv
, groupByColumnList
.asScala
.toList
,lst)
val newValue = getValFromJSONMessage(lv, aggregateColumnList.asScala.toList.head)
println(s"newKey = ${newKey}")
(newKey, newValue)}
.groupByKey(Serialized.`with`(Serdes.String(), Serdes.String()))
.aggregate{ () => 0.toString, (k,v,vr: Long) => (v.toString.toLong + vr.toString.toLong).toString }
You can only use the {}
form of method call to pass a single parameter, which is treated as a block. 您只能使用
{}
形式的方法调用来传递单个参数,该参数被视为一个块。 You need to pass two parameters, so use ()
instead: 您需要传递两个参数,因此请改用
()
:
aggregate( () => 0.toString, (k,v,vr: Long) => (v.toString.toLong + vr.toString.toLong).toString )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.