You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2022/12/20 17:05:00 UTC
[jira] [Commented] (KAFKA-14537) Materialized with / as ordering issues
[ https://issues.apache.org/jira/browse/KAFKA-14537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649894#comment-17649894 ]
Matthias J. Sax commented on KAFKA-14537:
-----------------------------------------
What you observe is behavior as design. Note that some methods (like `as()` and `with()`) are {_}static{_}. Those static methods are the "entry point" to create a new `Materialized` object with default config. If you have a `Materialized` object at hand, you can modify it calling non-static methods.
It's a Java thing, that you should never call a static method on an {_}object{_}. If you call a static method, it just creates a new object and you cannot chain method calls to modify an object.
Closing this ticket as "not a bug".
> Materialized with / as ordering issues
> --------------------------------------
>
> Key: KAFKA-14537
> URL: https://issues.apache.org/jira/browse/KAFKA-14537
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 3.3.1
> Environment: Java 17
> Reporter: Matt Allwood
> Priority: Major
>
> I have found a couple of cases where using Materialized .with and .as in the wrong order can either remove your configured serdes, reverting to the default configured serdes, or remove the store name, reverting to the auto-generated Kafka store name.
> This does not appear to affect .withKeySerde().withValueSerde pairs
> My most recent example is using a simple Processor node followed by a toTable()
> {code:java}
> .process(new PreferenceFlatteningProcessor(PREFERENCE_FLATTENING_STORE_NAME), PREFERENCE_FLATTENING_STORE_NAME)
> .toTable(
> Materialized
> .with(avroSerdes.commodityRegionValuesWithCLKeySerde, Serdes.Integer())
> .as("flattenedUserPreferencesTable"))
> {code}
> (apologies for formatting - it's difficult to see in JIRA)
> Having the .as in the above resulted in toTable failing as it tried to use the default serdes rather than those provided. It was a confusing bug, as the error suggested that the issue was in my .process() code in serialising the record rather than in the following toTable().
> As mentioned I have also encountered issues with the names going missing, but didn't raise that at the time, as it was an annoyance rather than crashing my application.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)