Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2538#discussion_r18373682
  
    --- Diff: python/pyspark/streaming/dstream.py ---
    @@ -0,0 +1,624 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +from itertools import chain, ifilter, imap
    +import operator
    +import time
    +from datetime import datetime
    +
    +from py4j.protocol import Py4JJavaError
    +
    +from pyspark import RDD
    +from pyspark.storagelevel import StorageLevel
    +from pyspark.streaming.util import rddToFileName, TransformFunction
    +from pyspark.rdd import portable_hash
    +from pyspark.resultiterable import ResultIterable
    +
    +__all__ = ["DStream"]
    +
    +
    +class DStream(object):
    +    """
    +    A Discretized Stream (DStream), the basic abstraction in Spark 
Streaming,
    +    is a continuous sequence of RDDs (of the same type) representing a
    +    continuous stream of data (see L{RDD} in the Spark core documentation
    +    for more details on RDDs).
    +
    +    DStreams can either be created from live data (such as, data from TCP
    +    sockets, Kafka, Flume, etc.) using a L{StreamingContext} or it can be
    +    generated by transforming existing DStreams using operations such as
    +    `map`, `window` and `reduceByKeyAndWindow`. While a Spark Streaming
    +    program is running, each DStream periodically generates a RDD, either
    +    from live data or by transforming the RDD generated by a parent 
DStream.
    +
    +    DStreams internally is characterized by a few basic properties:
    +     - A list of other DStreams that the DStream depends on
    +     - A time interval at which the DStream generates an RDD
    +     - A function that is used to generate an RDD after each time interval
    +    """
    +    def __init__(self, jdstream, ssc, jrdd_deserializer):
    +        self._jdstream = jdstream
    +        self._ssc = ssc
    +        self.ctx = ssc._sc
    --- End diff --
    
    We have a `context` method that returns the StreamingContext and this 
public `ctx` field that returns the underlying SparkContext.  This seems like 
it could be confusing, so maybe we should make the `ctx` field private.  On the 
other hand, RDD has a `ctx` field that returns the SparkContext, so this is 
consistent with that.


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