開始(DataStreamWriter)
DataFrameの内容をデータ ソースにストリームし、StreamingQuery オブジェクトを返します。
構文
start(path=None, format=None, outputMode=None, partitionBy=None, queryName=None, **options)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
| 文字列、オプション | Hadoopがサポートするファイルシステム内のパス。 |
| 文字列、オプション | 保存に使用されるフォーマット。 |
| 文字列、オプション | シンクへのデータの書き込み方法: |
| 文字列またはリスト(省略可能) | パーティショニング列の名前。 |
| 文字列、オプション | クエリの一意の名前。 |
| - | その他の文字列オプション。ほとんどのストリームには |
戻り値
StreamingQuery
例
Python
df = spark.readStream.format("rate").load()
基本的な例:
Python
q = df.writeStream.format('memory').queryName('this_query').start()
q.isActive
# True
q.name
# 'this_query'
q.stop()
q.isActive
# False
トリガーと追加の懸念:
Python
q = df.writeStream.trigger(processingTime='5 seconds').start(
queryName='that_query', outputMode="append", format='memory')
q.name
# 'that_query'
q.isActive
# True
q.stop()