Hi, Shammon,

I think the method `void deserialize(byte[] message, Collector<T> out)`
with a default implementation encapsulate how to deal with null for
developers. If we remove the `T deserialize(byte[] message)`, the
developers have to remember to handle null. Maybe we will get duplicate
code among them.
And I find there are only 5 implementations override the method `void
deserialize(byte[] message, Collector<T> out)`. Other implementations reuse
the same code to handle null.
I don't know the benefits of removing this method. Looking forward to other
people's opinions.

Best,
Hang



Shammon FY <zjur...@gmail.com> 于2023年2月28日周二 14:14写道:

> Hi devs
>
> Currently there are two deserialization methods in `DeserializationSchema`
> 1. `T deserialize(byte[] message)`, only deserialize one record from
> binary, if there is no record it should return null.
> 2. `void deserialize(byte[] message, Collector<T> out)`, supports
> deserializing none, one or multiple records gracefully, it can completely
> replace method `T deserialize(byte[] message)`.
>
> The deserialization logic in the above two methods is basically coincident,
> we recommend users use the second method to deserialize data. To improve
> code maintainability, I'd like to mark the first function as `@Deprecated`,
> and remove it when it is no longer used in the future.
>
> I have created an issue[1] to track it, looking forward to your feedback,
> thanks
>
> [1] https://issues.apache.org/jira/browse/FLINK-31251
>
>
> Best,
> Shammon
>

Reply via email to