Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-8318 Spark Streaming Starter JIRAs
  3. SPARK-9059

Update Python Direct Kafka Word count examples to show the use of HasOffsetRanges

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Not A Problem
    • None
    • None
    • DStreams

    Description

      Update Python examples of Direct Kafka word count to access the offset ranges using HasOffsetRanges and print it. For example in Scala,

      var offsetRanges: Array[OffsetRange] = _
      ...
      directKafkaDStream.foreachRDD { rdd => 
          offsetRanges = rdd.asInstanceOf[HasOffsetRanges]  
      }
      ...
      transformedDStream.foreachRDD { rdd => 
      
          // some operation
          println("Processed ranges: " + offsetRanges)
      }
      
      

      See https://spark.apache.org/docs/latest/streaming-kafka-integration.html for more info, and the master source code for more updated information on python.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tdas Tathagata Das
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: