Hi,

We are using the latest Kafka 0.10.1 branch. The combination of 
ProcessorTopologyTestDriver and WindowedStreamPartitioner is resulting in a 
division by 0 exception because of the empty list of partitions:

https://github.com/apache/kafka/blob/0.10.1/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java#L158
https://github.com/apache/kafka/blob/0.10.1/streams/src/main/java/org/apache/kafka/streams/kstream/internals/WindowedStreamPartitioner.java#L47

Our topology looks similar to this:

  builder.stream("events")
    .groupByKey(...)
    .aggregate(...,
      TimeWindows.of(1 * 60 * 1000L)
    )
    .mapValues(_.size: Integer)
    .to(windowedSerde, Serdes.Integer(), "events-over-time")

If we use our own partitioner in .to() it works.

  class MyStreamPartitioner[K, V]() extends StreamPartitioner[K, V] {
    override def partition(k: K, v: V, numPartitions: Int): Integer = {
      // return an integer between 0 and numPartitions-1, or null if the 
default partitioning logic should be used
      null
    }
  }

Is this a bug?

Thank you in advance,
Hamid

Reply via email to