からSCIOを使用 spotify
して のジョブを書き込みます。たとえば、 g1とe.g2Dataflow
の 2 つの例に従って にストリームを書き込みますが、以下のコードでは次のエラーが発生します。PubSub
GCS
エラー
Exception in thread "main" java.lang.IllegalArgumentException: Write can only be applied to a Bounded PCollection
コード
object StreamingPubSub {
def main(cmdlineArgs: Array[String]): Unit = {
// set up example wiring
val (opts, args) = ScioContext.parseArguments[ExampleOptions](cmdlineArgs)
val dataflowUtils = new DataflowExampleUtils(opts)
dataflowUtils.setup()
val sc = ScioContext(opts)
sc.pubsubTopic(opts.getPubsubTopic)
.timestampBy {
_ => new Instant(System.currentTimeMillis() - (scala.math.random * RAND_RANGE).toLong)
}
.withFixedWindows((Duration.standardHours(1)))
.groupBy(_ => Unit)
.toWindowed
.toSCollection
.saveAsTextFile(args("output"))
val result = sc.close()
// CTRL-C to cancel the streaming pipeline
dataflowUtils.waitToFinish(result.internal)
}
}
ウィンドウの概念を Bounded PCollection と混同している可能性があります。これを達成する方法はありますか、それともこれを実現するために何らかの変換を適用する必要がありますか?