You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "amaliujia (via GitHub)" <gi...@apache.org> on 2023/04/20 22:09:09 UTC

[GitHub] [spark] amaliujia commented on a diff in pull request #40887: [SPARK-43144] Scala Client DataStreamReader table() API

amaliujia commented on code in PR #40887:
URL: https://github.com/apache/spark/pull/40887#discussion_r1173134297


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/streaming/DataStreamReader.scala:
##########
@@ -217,6 +217,20 @@ final class DataStreamReader private[sql] (sparkSession: SparkSession) extends L
    */
   def parquet(path: String): DataFrame = format("parquet").load(path)
 
+  /**
+   * Define a Streaming DataFrame on a Table. The DataSource corresponding to the table should
+   * support streaming mode.
+   * @param tableName The name of the table
+   * @since 3.5.0
+   */
+  def table(tableName: String): DataFrame = {
+    require(tableName != null, "The table name can't be null")
+    sparkSession.newDataFrame { builder =>
+      builder.getReadBuilder.setIsStreaming(true).getNamedTableBuilder

Review Comment:
   Is there a way to also test the options? Maybe `spark.readStream().option().table()`?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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