Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,17 @@ final case class SpannerWrite(config: SpannerConfig) extends SpannerIO[Mutation]
override type WriteP = SpannerWrite.WriteParam

override protected def write(data: SCollection[Mutation], params: WriteP): Tap[Nothing] = {
val transform = BSpannerIO
.write()
.withSpannerConfig(config)
.withBatchSizeBytes(params.batchSizeBytes)
.withFailureMode(params.failureMode)
val coder = CoderMaterializer.beam(data.context, coders.spannerMutationCoder)

val transform = BSpannerIO
.write()
.withSpannerConfig(config)
.withBatchSizeBytes(params.batchSizeBytes)
.withFailureMode(params.failureMode)

data.applyInternal(transform)
data.setCoder(coder).applyInternal(transform)
EmptyTap
}
}

override protected def read(sc: ScioContext, params: ReadP): SCollection[Mutation] = sc.wrap {
throw new UnsupportedOperationException("SpannerWrite is write-only")
Expand Down