Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12049#discussion_r57943784
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala
 ---
    @@ -71,9 +71,18 @@ class StreamExecution(
       /** The current batchId or -1 if execution has not yet been initialized. 
*/
       private var currentBatchId: Long = -1
     
    +  private[sql] val logicalPlan = _logicalPlan.transform {
    +    case StreamingRelation(sourceCreator, output) =>
    +      // Materialize source to avoid creating it in every batch
    +      val source = sourceCreator()
    +      // We still need to use the previous `output` instead of 
`source.schema` as attributes in
    +      // "_logicalPlan" has already used attributes of the previous 
`output`.
    +      StreamingRelation(() => source, output)
    --- End diff --
    
    I think its confusing to have an opaque function that sometimes is creating 
a `source` and sometimes returning a static `source`.  Its not going to be 
clear from `explain()` which mode you are in.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to