Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/12320#discussion_r59917419
--- 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 --
@davies is this pythonic? Should it just be `processingTime="5 seconds"`?
---
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]