Hi Jiunn-Yang, Regardless of what form the KIP takes and when it's implemented, near term it would be good to see a PR with some of these null edge cases clearly spelled out in the JavaDoc. Then, once the KIP is accepted, those comments could be updated with the intended future changes.
Thanks, Kirk On Sat, Mar 22, 2025, at 7:54 PM, 黃竣陽 wrote: > Hello Ismael, > > Thanks for your comments. > > **Q1:** I believe this change should be introduced in Kafka 5.0. I will > include a note about this in the KIP. > > **Q2, Q3:** > Although these methods are not explicitly mentioned, they currently return > null. While tracing the code, I found that null is returned when the timeout > is set to zero, causing the method to return an empty result immediately. > (ListOffsetEvent#emptyResults) > > Regardless of whether the existing JavaDoc mentions returning null, I believe > this behavior should be explicitly documented, along with a note stating that > it will be removed in Kafka 5.0. I will also address this in the KIP. > > Best Regards, > Jiunn-Yang > > > Ismael Juma <m...@ismaeljuma.com> 於 2025年3月20日 凌晨4:45 寫道: > > > > Hi, > > > > Thanks for the KIP. A few comments: > > > > 1. Incompatible changes are generally not allowed in minor releases. Are > > you proposing a change for a minor release (eg 4.1) or for a major release > > (5.0)? > > 2. Given that clients in 4.0 support brokers with version 2.1 or higher, > > `offsetsForTimes` should never return maps with `null` values (check the > > javadoc for the details of when this happens). We can perhaps consider this > > a documentation fix (versus a behavior change). > > 3. The other methods specified in the `public interfaces` section don't > > specify if the returned maps can contain `null`. Can they? If so, we should > > make that clear in the KIP along with the details of how we intend to make > > the change in a compatible way. > > > > Thanks, > > Ismael > > > > On Fri, Mar 14, 2025 at 4:31 AM 黃竣陽 <s7133...@gmail.com> wrote: > > > >> Hello everyone, > >> > >> I would like to start a discussion on KIP-1140: Avoid to return null value > >> in Map from public api of consumer > >> <https://cwiki.apache.org/confluence/x/mIuMEw> > >> > >> This proposal aims to improve the Kafka consumer API by ensuring that the > >> Map it returns contains only non-null values, > >> aligning with the design philosophy of Java collections. This change > >> provides significantly more benefits than drawbacks, > >> enhancing API consistency and usability while reducing errors caused by > >> developer misuse. > >> > >> Best Regards, > >> Jiunn-Yang > >