Fix Streams Scala foreach recursive call#5539
Conversation
0b1eaeb to
43e6da8
Compare
|
@vvcephei could you take a look? |
|
This PR is good to go. |
There was a problem hiding this comment.
Technically, this is a public interface change, and would require a KIP.
Note that we don't really need the implicit; it just makes the internal implementation nicer. You could instead do:
def foreach(action: (K, V) => Unit): Unit =
inner.foreach(new ForeachAction[K, V] {
override def apply(key: K, value: V): Unit = action(key, value)
})right?
|
Can you explain the mechanism by which the call becomes recursive? I feel like I'm missing it... |
|
Can you please add a brief description? The description will become the commit message when we squash and merge. Also, does it make sense to reference KAFKA-7316 also in this PR's title? You could drop a quick comment on that ticket that forEach is also affected. |
|
Basically it's doing an implicit conversion back to the Scala API threw the |
4d8de11 to
211abd0
Compare
There was a problem hiding this comment.
Now it's not public anymore
There was a problem hiding this comment.
Ah! I misread this before. This class was already defaulted to public visibility, and we can't retract it now, without a KIP.
I recommend moving the private[streams] to just the new method.
Sorry for the confusion.
( I wish I had noticed before that the whole object was public unnecessarily )
|
Oh, I get it. I'd forgotten that we have (e.g.) |
|
Are we good with this one @vvcephei ? |
|
@joan38 last commit causes some conflicts, you'd need to rebase this PR again. |
|
I will, in an hour or so. |
|
@joan38 Also, please see my note on privatizing FunctionConversions. I misread it yesterday. |
|
Sure I can do that. |
|
@guozhangwang All good to merge |
|
@guozhangwang This needs to be cherry-picked to 2.0 |
Reviewers: Guozhang Wang <guozhang@confluent.io>, John Roesler <john@confluent.io>
|
Thanks for the reminder! Just did it. |
Reviewers: Guozhang Wang <guozhang@confluent.io>, John Roesler <john@confluent.io>
Due to lack of conversion to kstream Predicate, existing foreach method in KStream.scala would result in StackOverflowError.
This PR fixes the bug and adds testing for it.