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

Jeyhun Karimov commented on KAFKA-3839:
---------------------------------------

It seems that groupby operator is gone from KTable. Nevertheless, I checked its 
behaviour with null keys:

      KTable<Long, String> source = builder.table(longSerde, stringSerde, 
"topic1");
      KTable<String,Long> counts =  source.
                  groupBy(new KeyValueMapper<Long, String, KeyValue<String, 
String>>() {

                @Override
                public KeyValue<String, String> apply(Long key, String value) {
                        // TODO Auto-generated method stub
                         return  KeyValue.pair(null, value);
                }
        },Serdes.String(), Serdes.String()).count("count");
      counts.to(stringSerde,longSerde,"topic2");

If I run this code, no exception/error is got and nothing is outputted to topic 
(as expected). I check the class KTableRepartitionMap.KTableMapProcessor and I 
think the required null checks are there in process() method.





> Handling null keys in KTable.groupBy
> ------------------------------------
>
>                 Key: KAFKA-3839
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3839
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Guozhang Wang
>            Assignee: Jeyhun Karimov
>              Labels: architecture, newbie
>
> This is first reported by [~jeff.klu...@gmail.com].
> Similarly as we handle null keys in KStream join and aggregations in 
> KAFKA-3561 (https://github.com/apache/kafka/pull/1472), for KTable.groupBy 
> operators we should also gracefully handle null keys by filter them out since 
> they will not be participating in the aggregation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to