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 2021/04/02 21:24:54 UTC

[GitHub] [spark] sunchao opened a new pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

sunchao opened a new pull request #32039:
URL: https://github.com/apache/spark/pull/32039


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   In `WriteToMicroBatchDataSource`, replace `WriteToDataSourceV2` with `AppendData`, as the former is deprecated. To realize this, this changes several methods to pass `DataSourceV2Relation` instead of `Table`.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   Currently `WriteToDataSourceV2` doesn't have refresh cache logic, and therefore, when the target table for a micro batch streaming job is cached, the cache won't be refreshed when the table is updated. It is also deprecated and replaced by more specific logical plans like `AppendData`.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   Yes now when a DSv2 table which supports streaming write is updated by a streaming job, its cache will also be refreshed.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   
   Added a new UT.


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816871987


   **[Test build #137151 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137151/testReport)** for PR 32039 at commit [`239fafd`](https://github.com/apache/spark/commit/239fafd5e58247eee12e9cddb5e23ae9972bbfe0).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814468089


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/136962/
   


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814292768


   **[Test build #136962 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136962/testReport)** for PR 32039 at commit [`801d35a`](https://github.com/apache/spark/commit/801d35a58ddba155d0f4da5b7d013058c10d7429).


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816833416






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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814335006


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41539/
   


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814236687


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41529/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816833450


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41726/
   


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812739126


   **[Test build #136869 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136869/testReport)** for PR 32039 at commit [`0891cd1`](https://github.com/apache/spark/commit/0891cd14c57d04fa3efc4ae374029a5aff7d7dc5).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class WriteToMicroBatchDataSource(`


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814468089


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/136962/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816979907


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137147/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814198935


   **[Test build #136953 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136953/testReport)** for PR 32039 at commit [`bf8d519`](https://github.com/apache/spark/commit/bf8d5198ec3dfd56e1955312cdb3a1b5cc3b8496).


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816803554


   **[Test build #137147 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137147/testReport)** for PR 32039 at commit [`779a8d2`](https://github.com/apache/spark/commit/779a8d24486d7a322ece838fc0ab070d080c974f).


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-817017716


   **[Test build #137151 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137151/testReport)** for PR 32039 at commit [`239fafd`](https://github.com/apache/spark/commit/239fafd5e58247eee12e9cddb5e23ae9972bbfe0).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818037255


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41808/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812745537






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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814283665


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/136953/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818037255


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41808/
   


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


[GitHub] [spark] cloud-fan commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818737896


   thanks, merging to master!


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812741133


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41447/
   


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


[GitHub] [spark] viirya commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609944372



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
##########
@@ -250,10 +252,13 @@ case class OverwritePartitionsDynamicExec(
 
 case class WriteToDataSourceV2Exec(
     batchWrite: BatchWrite,
+    refreshCache: () => Unit,
     query: SparkPlan) extends V2TableWriteExec {
 
   override protected def run(): Seq[InternalRow] = {
-    writeWithV2(batchWrite)
+    val writtenRows = writeWithV2(batchWrite)
+    refreshCache()
+    writtenRows

Review comment:
       Instead of refreshing/invalidating the table per trigger, why we don't just invalidate the cache before we start the streaming query that writes the 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.

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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-817994332


   **[Test build #137228 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137228/testReport)** for PR 32039 at commit [`a884b47`](https://github.com/apache/spark/commit/a884b472bc40f49404b75c853c0399c6549435cd).


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


[GitHub] [spark] cloud-fan commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609890974



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = relationOpt match {
+        case Some(r) => refreshCache(r)

Review comment:
       I think refreshing the cache per second (assuming the streaming trigger is one second) doesn't make sense. Invalidating seems more reasonable.




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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816908709


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41730/
   


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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r611810613



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecution.scala
##########
@@ -39,7 +39,8 @@ class MicroBatchExecution(
     trigger: Trigger,
     triggerClock: Clock,
     extraOptions: Map[String, String],
-    plan: WriteToStream)
+    plan: WriteToStream,
+    catalogAndIdent: Option[(CatalogPlugin, Identifier)] = None)

Review comment:
       Good point. `WriteToStream` is a better place for this information.




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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816908709


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41730/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818285485


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137228/
   


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814198935


   **[Test build #136953 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136953/testReport)** for PR 32039 at commit [`bf8d519`](https://github.com/apache/spark/commit/bf8d5198ec3dfd56e1955312cdb3a1b5cc3b8496).


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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816871987


   **[Test build #137151 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137151/testReport)** for PR 32039 at commit [`239fafd`](https://github.com/apache/spark/commit/239fafd5e58247eee12e9cddb5e23ae9972bbfe0).


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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609965321



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
##########
@@ -250,10 +252,13 @@ case class OverwritePartitionsDynamicExec(
 
 case class WriteToDataSourceV2Exec(
     batchWrite: BatchWrite,
+    refreshCache: () => Unit,
     query: SparkPlan) extends V2TableWriteExec {
 
   override protected def run(): Seq[InternalRow] = {
-    writeWithV2(batchWrite)
+    val writtenRows = writeWithV2(batchWrite)
+    refreshCache()
+    writtenRows

Review comment:
       Yes that should work too and also will require fewer code changes. I went this way to be consistent with other V2 write commands. Also, in future we may introduce `DataStreamWriterV2` which could pass write node with `UnresolvedRelation` to analyzer and be converted to execution plan, and this approach may fit better in that case.
   
   
   




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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609942994



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = relationOpt match {
+        case Some(r) => refreshCache(r)

Review comment:
       Thanks all! Let me switch to invalidating cache. IMO a config isn't necessary since ppl may never want this behavior (it could get very expensive).




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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816803554


   **[Test build #137147 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137147/testReport)** for PR 32039 at commit [`779a8d2`](https://github.com/apache/spark/commit/779a8d24486d7a322ece838fc0ab070d080c974f).


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818269445


   **[Test build #137228 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137228/testReport)** for PR 32039 at commit [`a884b47`](https://github.com/apache/spark/commit/a884b472bc40f49404b75c853c0399c6549435cd).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] imback82 commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
imback82 commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r610811514



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = () => relationOpt match {

Review comment:
       Seems like we are invalidating the cache, and not refreshing?

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
##########
@@ -847,6 +848,34 @@ class DataSourceV2SQLSuite
     }
   }
 
+  test("SPARK-34947: micro batch streaming write should refresh cache") {

Review comment:
       "should invalidate cache"?




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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816978395


   **[Test build #137147 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137147/testReport)** for PR 32039 at commit [`779a8d2`](https://github.com/apache/spark/commit/779a8d24486d7a322ece838fc0ab070d080c974f).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-817021997


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137151/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812730667


   **[Test build #136869 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136869/testReport)** for PR 32039 at commit [`0891cd1`](https://github.com/apache/spark/commit/0891cd14c57d04fa3efc4ae374029a5aff7d7dc5).


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


[GitHub] [spark] sunchao commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-815283833


   I think the test failures are not related. cc @HeartSaVioR @cloud-fan and @aokolnychyi


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812730667


   **[Test build #136869 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136869/testReport)** for PR 32039 at commit [`0891cd1`](https://github.com/apache/spark/commit/0891cd14c57d04fa3efc4ae374029a5aff7d7dc5).


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


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609090609



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = relationOpt match {
+        case Some(r) => refreshCache(r)

Review comment:
       If you have a concern, why don't we have a config for that? We can have a controllability to invalidate or to refresh.




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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818285485


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137228/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-817994332


   **[Test build #137228 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137228/testReport)** for PR 32039 at commit [`a884b47`](https://github.com/apache/spark/commit/a884b472bc40f49404b75c853c0399c6549435cd).


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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r610813618



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
##########
@@ -847,6 +848,34 @@ class DataSourceV2SQLSuite
     }
   }
 
+  test("SPARK-34947: micro batch streaming write should refresh cache") {

Review comment:
       You're right - forgot to update this.




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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814276784


   **[Test build #136953 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136953/testReport)** for PR 32039 at commit [`bf8d519`](https://github.com/apache/spark/commit/bf8d5198ec3dfd56e1955312cdb3a1b5cc3b8496).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class WriteToDataSourceV2(`
     * `case class WriteToMicroBatchDataSource(`


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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814334971






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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814454524


   **[Test build #136962 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136962/testReport)** for PR 32039 at commit [`801d35a`](https://github.com/apache/spark/commit/801d35a58ddba155d0f4da5b7d013058c10d7429).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class WriteToDataSourceV2(`
     * `case class WriteToMicroBatchDataSource(`


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814242218


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41529/
   


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


[GitHub] [spark] cloud-fan commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r611464939



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecution.scala
##########
@@ -39,7 +39,8 @@ class MicroBatchExecution(
     trigger: Trigger,
     triggerClock: Clock,
     extraOptions: Map[String, String],
-    plan: WriteToStream)
+    plan: WriteToStream,
+    catalogAndIdent: Option[(CatalogPlugin, Identifier)] = None)

Review comment:
       shall we put this info in `WriteToStream`? It's very weird to see `catalogAndIdent` as a parameter of `MicroBatchExecution`.




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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814242218


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41529/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816979907


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137147/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816833450


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41726/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814292768


   **[Test build #136962 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136962/testReport)** for PR 32039 at commit [`801d35a`](https://github.com/apache/spark/commit/801d35a58ddba155d0f4da5b7d013058c10d7429).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-812745537






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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r608244064



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = relationOpt match {
+        case Some(r) => refreshCache(r)

Review comment:
       I'm not sure if refresh cache is the best choice in the context of streaming - perhaps we should invalidate it?




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


[GitHub] [spark] viirya commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609932691



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = relationOpt match {
+        case Some(r) => refreshCache(r)

Review comment:
       Hmm, I cannot think about a use-case we want to refresh the cache of a table written by 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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814335006


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/41539/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-814283665


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/136953/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-817021997


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137151/
   


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


[GitHub] [spark] sunchao commented on a change in pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should refresh its associated cache

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r610813771



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -138,8 +138,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
 
       withProjection :: Nil
 
-    case WriteToDataSourceV2(writer, query) =>
-      WriteToDataSourceV2Exec(writer, planLater(query)) :: Nil
+    case WriteToDataSourceV2(relationOpt, writer, query) =>
+      val refreshCacheFunc: () => Unit = () => relationOpt match {

Review comment:
       Yes this too - will update. Thanks.




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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-818037193






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


[GitHub] [spark] SparkQA commented on pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32039:
URL: https://github.com/apache/spark/pull/32039#issuecomment-816900487


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41730/
   


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


[GitHub] [spark] cloud-fan closed pull request #32039: [SPARK-34947][SQL] Streaming write to a V2 table should invalidate its associated cache

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #32039:
URL: https://github.com/apache/spark/pull/32039


   


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