[ 
https://issues.apache.org/jira/browse/KAFKA-7653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16694085#comment-16694085
 ] 

John Roesler commented on KAFKA-7653:
-------------------------------------

Hey all, I'll jump in, too, if you don't mind...

Yeah, I think this change will need a KIP for sure. However, given our recent 
experience with API changes to the scala interface, it's a little hard to 
discuss changes like this in the abstract, so I think we should start with a 
PR, agree on the approach, and then proceed with a KIP to formalize/ratify it, 
and then finalize the PR.

This way, everyone can download the changeset and play around with the 
different possibilities.

Of course, we should seek a solution that doesn't break anyone, but as we've 
seen in the past, this may be an unattainable goal, and we might have to back 
off to not breaking anyone who uses implicits with a wildcard import. Still, 
the first preference is full compatibility.

Thanks,

-John

> Streams-Scala: Add type level differentiation for Key and Value serdes.
> -----------------------------------------------------------------------
>
>                 Key: KAFKA-7653
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7653
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: Mark Tranter
>            Assignee: Mark Tranter
>            Priority: Minor
>              Labels: scala
>
> Implicit resolution/conversion of Serdes/Consumed etc is a big improvement 
> for the Scala Streams API. However in cases where a user needs to 
> differentiate between Key and Value serializer functionality (i.e. using the 
> Schema Registry), implicit resolution doesn't help and could cause issues. 
> e.g.
> {code:java}
> case class MouseClickEvent(pageId: Long, userId: String)
> builder
>   // Long serde taken from implicit scope configured with
>   // `isKey` = true
>   .stream[Long, MouseClickEvent]("mouse-clicks")
>   .selectKey((_,v) => v.userId)
>   .groupByKey
>   .aggregate(() => 0L, (_: String, mce: MouseClickEvent, count: Long) => 
> count + 1)
>   .toStream
>   // Same Long serde taken from implicit scope configured with
>   // `isKey` = true, even thought the `Long` value in this case
>   // will be the Value
>   .to("mouse-clicks-by-user")
> {code}
> It would be ideal if Key and Value Serde/SerdeWrapper types/type classes 
> could be introduced to overcome this limitation.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to