[
https://issues.apache.org/jira/browse/KAFKA-7386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16607388#comment-16607388
]
ASF GitHub Bot commented on KAFKA-7386:
---------------------------------------
vvcephei opened a new pull request #5622: KAFKA-7386: streams-scala should not
cache serdes
URL: https://github.com/apache/kafka/pull/5622
Currently, `scala.Serdes.String`, for example, invokes Serdes.String() once
and caches the result.
However, the implementation of the String serde has a non-empty configure
method that is variant in whether it's used as a key or value serde. So we
won't get correct execution if we create one serde and use it for both keys and
values.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Streams Scala wrapper should not cache serdes
> ---------------------------------------------
>
> Key: KAFKA-7386
> URL: https://issues.apache.org/jira/browse/KAFKA-7386
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 2.0.0, 2.1.0
> Reporter: John Roesler
> Assignee: John Roesler
> Priority: Major
> Fix For: 2.0.1, 2.1.0
>
>
> for example,
> [https://github.com/apache/kafka/blob/trunk/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/Serdes.scala#L28]
> invokes Serdes.String() once and caches the result.
> However, the implementation of the String serde has a non-empty configure
> method that is variant in whether it's used as a key or value serde. So we
> won't get correct execution if we create one serde and use it for both keys
> and values.
> The fix is simple: change all the `val` declarations in scala.Serdes to
> `def`. Thanks to the referential transparency for parameterless methods in
> scala, no user-facing code will break.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)