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

Mohammad Yousuf Minhaj Zia commented on KAFKA-13641:
----------------------------------------------------

If I am not wrong, the `ValueJoiner` is a java class which is sort of like a 
function signature with generic parameters `value1` and `value2`. What I would 
like is to create a Scala wrapper such that:

```

type ValueLeftJoiner[A, B, C) => (A, Option[B]) => C

type ValueOuterJoiner[A, B, C) => (Option[A], B) => C

type ValueInnerJoiner[A, B, C) => (A, B) => C

```

 

or to deal with tombstones just make both inputs optional with a central 
ValueJoiner:

 

```

type ValueJoiner[A, B, C) => (Option[A], Option[B]) => C

```

 

Unfortunately this makes things quite inconsistent with the rest of the 
codebase because a null could be returned or be a parameter virtually anywhere 
apart from joiners.

Wondering if we will ever making the explicitness of nullable fields better in 
Kafka?

> Kafka Streams Scala: Add `Option` to `ValueJoiner` parameters
> -------------------------------------------------------------
>
>                 Key: KAFKA-13641
>                 URL: https://issues.apache.org/jira/browse/KAFKA-13641
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: Mohammad Yousuf Minhaj Zia
>            Priority: Minor
>
> Since `ValueJoiner` right parameter in `leftJoins`, `outerJoins` can be 
> nullable, I am wondering if can wrap them around Scala `Option`.
> However, there is also the concern that the left hand side value can be null 
> in the case of tombstone messages, in which the `Option` semantics can be 
> misleading. I still feel this could be a useful feature in reducing the 
> number of `NullPointerExceptions`.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to