Github user liyintang commented on the pull request:

    https://github.com/apache/spark/pull/11921#issuecomment-200960606
  
    @koeninger:
    
    here is the min code example to reproduce this issue:
    
    <  
           // Create context
           val ssc = new StreamingContext(sparkConf, Seconds(intervalSeconds))
    
            // Create topic, kafkaParams, messageHandler and offsetnRanges
            val topicsSet: Set[String] = "flog".split(",").toSet
            val kafkaParams = Map[String, String]("metadata.broker.list" -> 
KafkaCluster.MAIN.getKafkaConnString)
            val messageHandler = (mmd: MessageAndMetadata[String, String]) => 
mmd
            val topicPartitionOffsetRange = KafkaOffsetsUtil.getKafkaOffsets(
                KafkaCluster.MAIN,
                topicsSet.toList.asJava,
                
kafka.api.OffsetRequest.LatestTime).toMap.mapValues(Long2long).take(10)
    
            // Create a DStream
            val inputStream = KafkaUtils.createDirectStream[String, String, 
StringDecoder, StringDecoder, MessageAndMetadata[String, String]](
                ssc,
                kafkaParams,
                topicPartitionOffsetRange,
                messageHandler)
    
            // Apply window function with simple count
            inputStream.window(Seconds(slidingWindowInterval), 
Seconds(intervalSeconds)).foreachRDD(rdd => rdd.count())
    
            ssc.start()
            ssc.awaitTermination() 
    >


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to