You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/09/18 01:36:57 UTC
[GitHub] [spark] viirya commented on a change in pull request #29767: [SPARK-32896][SS] Add DataStreamWriter.table API
viirya commented on a change in pull request #29767:
URL: https://github.com/apache/spark/pull/29767#discussion_r490651024
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/streaming/DataStreamWriter.scala
##########
@@ -300,54 +301,44 @@ final class DataStreamWriter[T] private[sql](ds: Dataset[T]) {
"write files of Hive data source directly.")
}
- if (source == "memory") {
+ if (source == SOURCE_NAME_TABLE) {
+ assertNotPartitioned("table")
+
+ import df.sparkSession.sessionState.analyzer.CatalogAndIdentifier
+
+ import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
+ val CatalogAndIdentifier(catalog, identifier) = df.sparkSession.sessionState.sqlParser
+ .parseMultipartIdentifier(tableName)
+ val tableInstance = catalog.asTableCatalog.loadTable(identifier)
+
+ import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Implicits._
+ val sink = tableInstance match {
+ case t: SupportsWrite if t.supports(STREAMING_WRITE) => t
+ case t => throw new AnalysisException("Table doesn't support streaming " +
Review comment:
s"Table $tableName doesn't support streaming "?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org