cloud-fan commented on a change in pull request #23430: [SPARK-26520][SQL] data
source v2 API refactor (micro-batch read)
URL: https://github.com/apache/spark/pull/23430#discussion_r249327956
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecution.scala
##########
@@ -90,36 +88,39 @@ class MicroBatchExecution(
logInfo(s"Using Source [$source] from DataSourceV1 named
'$sourceName' [$dataSourceV1]")
StreamingExecutionRelation(source, output)(sparkSession)
})
- case s @ StreamingRelationV2(
- dataSourceV2: MicroBatchReadSupportProvider, sourceName, options,
output, _) if
- !disabledSources.contains(dataSourceV2.getClass.getCanonicalName) =>
- v2ToExecutionRelationMap.getOrElseUpdate(s, {
+ case s @ StreamingRelationV2(ds, dsName, table: SupportsMicroBatchRead,
options, output, _)
+ if !disabledSources.contains(ds.getClass.getCanonicalName) =>
+ v2ToRelationMap.getOrElseUpdate(s, {
// Materialize source to avoid creating it in every batch
val metadataPath = s"$resolvedCheckpointRoot/sources/$nextSourceId"
- val readSupport = dataSourceV2.createMicroBatchReadSupport(
- metadataPath,
- new DataSourceOptions(options.asJava))
nextSourceId += 1
- readSupportToDataSourceMap(readSupport) = dataSourceV2 -> options
- logInfo(s"Using MicroBatchReadSupport [$readSupport] from " +
- s"DataSourceV2 named '$sourceName' [$dataSourceV2]")
- StreamingExecutionRelation(readSupport, output)(sparkSession)
+ logInfo(s"Reading table [$table] from DataSourceV2 named '$dsName'
[$ds]")
+ val dsOptions = new DataSourceOptions(options.asJava)
+ // TODO: operator pushdown.
Review comment:
It's not urgent, as no builtin streaming source supports pushdown yet. The
ds v2 API can handle pushdown, and our batch sources do support it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]