spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brkyvz <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-14555] First cut of Python API for Stru...
Date Fri, 15 Apr 2016 18:23:58 GMT
Github user brkyvz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12320#discussion_r59918462
  
    --- Diff: python/pyspark/sql/readwriter.py ---
    @@ -395,6 +425,38 @@ def partitionBy(self, *cols):
             self._jwrite = self._jwrite.partitionBy(_to_seq(self._sqlContext._sc, cols))
             return self
     
    +    @since(2.0)
    +    def queryName(self, queryName):
    +        """Specifies the name of the :class:`ContinuousQuery` that can be started with
    +        :func:`startStream`. This name must be unique among all the currently active
queries
    +        in the associated SQLContext.
    +
    +        :param queryName: unique name for the query
    +
    +        >>> writer = sdf.write.queryName('streaming_query')
    +        """
    +        if not queryName or type(queryName) != str or len(queryName.strip()) == 0:
    +            raise ValueError('The queryName must be a non-empty string. Got: %s' % queryName)
    +        self._jwrite = self._jwrite.queryName(queryName)
    +        return self
    +
    +    @since(2.0)
    +    def trigger(self, trigger):
    +        """Set the trigger for the stream query. If this is not set it will run the query
as fast
    +        as possible, which is equivalent to setting the trigger to ``ProcessingTime('0
seconds')``.
    +
    +        :param trigger: a :class:`Trigger`.
    +
    +        >>> from pyspark.sql.streaming import ProcessingTime
    +        >>> # trigger the query for execution every 5 seconds
    +        >>> writer = sdf.write.trigger(ProcessingTime('5 seconds'))
    --- End diff --
    
    @marmbrus We may have different trigger methods, which are actually classes in scala.
I don't imagine us having a lot of trigger methods, but if we keep adding them, we will need
to keep adding parameters here.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message