Github user c-kang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9545#discussion_r44306010
  
    --- Diff: docs/streaming-programming-guide.md ---
    @@ -1948,8 +1948,8 @@ unifiedStream.print();
     {% highlight python %}
     numStreams = 5
     kafkaStreams = [KafkaUtils.createStream(...) for _ in range (numStreams)]
    -unifiedStream = streamingContext.union(kafkaStreams)
    -unifiedStream.print()
    +unifiedStream = streamingContext.union(*kafkaStreams)
    --- End diff --
    
    @srowen right.  The method is: def union(self, *dstreams), so it expects a 
variable number of dstreams passed in as arguments.  If you pass in a list of 
dstreams without unpacking it, then vargs= [kafkaStreams, ] as opposed to vargs 
= [stream1, stream2, stream3, ...].  In the method then, len(vargs) == 1, so it 
just returns [kafkaStreams] as the unifiedStream without actually performing 
the union.  And then unifiedStream.pprint() will fail because unifiedStream is 
not a dstream but a list.


---
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