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

Matthias J. Sax commented on KAFKA-8828:
----------------------------------------

From 
[https://kafka.apache.org/23/documentation/streams/upgrade-guide#streams_api_changes_230]
{quote}While this change is mainly transparent, there are some corner cases 
that may require code changes: *Caution: If you receive an untyped store and 
use a cast, you might need to update your code to cast to the correct type. 
Otherwise, you might get an exception similar to{{java.lang.ClassCastException: 
class org.apache.kafka.streams.state.ValueAndTimestamp cannot be cast to class 
YOUR-VALUE-TYPE}} upon getting a value from the store.*
{quote}
Hence, it's not a bug, but a known and documented change.

In general, you are not supposed to access state stores that you did not add 
yourself. As you pointed out, the store is added by the DSL layer internally 
and hence, accessing it in a custom transformer is kind of an anti-pattern as 
you don't really own the store. Does this make sense?

 

> [BC Break] Global store returns a TimestampedKeyValueStore in 2.3
> -----------------------------------------------------------------
>
>                 Key: KAFKA-8828
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8828
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 2.3.0
>            Reporter: Marcos Passos
>            Priority: Major
>
> Since 2.3, {{ProcessorContext}} returns a {{TimestampedKeyValueStore}} for 
> global stores, which is backward incompatible. This change makes the upgrade 
> path a lot painful and involves creating a non-trivial adapter to hide the 
> timestamp-related functionality in cases where it is not needed.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to