Skip to content

Instantly share code, notes, and snippets.

@yjshen
Last active July 15, 2019 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yjshen/36987b6ca6c711fa340e242957cbad05 to your computer and use it in GitHub Desktop.
Save yjshen/36987b6ca6c711fa340e242957cbad05 to your computer and use it in GitHub Desktop.
Source and Sink API in Spark Structured Streaming.
trait Source {
def schema: StructType
def getOffset: Option[Offset]
def getBatch(start: Option[Offset], end: Offset): DataFrame
def commit(end: Offset): Unit
def stop(): Unit
}
trait Sink {
def addBatch(batchId: Long, data: DataFrame): Unit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment