mjsax commented on code in PR #18877:
URL: https://github.com/apache/kafka/pull/18877#discussion_r1962363168
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/SinkNode.java:
##########
@@ -56,18 +56,19 @@ public void addChild(final ProcessorNode<Void, Void, ?, ?>
child) {
throw new UnsupportedOperationException("sink node does not allow
addChild");
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
Review Comment:
KS runtime is inherently none-type-safe at many places. It's how the code is
wired up. We cannot always check types... Especially for the Processor API, and
inside the runtime.
We do have some tickets to address / improve some of these things, but it
should be independent of this PR, and it won't be possible to address all of
them...
> But SinkNode.prepareKeySerializer takes a Serializer<KIn> and Context<KIn,
?>. It seems to me that it should be <Void, ?> (because that's KOut) and the
cast should not be required at all.
That's good point, but actually not the right conclusion. The expected type
should be `ProcessorContext<?, ?> context`, because we don't care about the
output type at all... (I guess we could also say `ProcessorContext<Void, Void>
context` as we know that we should only call this from a `SinkNode` which
happens to be `<Void, Void>` type... However, the key/value type of the
`ProcessorContext` has nothing to do with they serializer type which is
`KIn`... (we only pass the `ProcessorContext` for the case we need to get the
default serde from the config, with is `Serde<?>` anyway...)
I'll fix this in a follow up PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]