GitHub user tdas opened a pull request:

    https://github.com/apache/spark/pull/15885

    [SPARK-18440][Structured Streaming] Pass correct query execution to 
FileFormatWriter

    ## What changes were proposed in this pull request?
    
    SPARK-18012 refactored the file write path in FileStreamSink using 
FileFormatWriter which always uses the default non-streaming QueryExecution to 
perform the writes. This is wrong for FileStreamSink, because the streaming 
QueryExecution (i.e. IncrementalExecution) should be used for correctly 
incrementalizing aggregation. The addition of watermarks in SPARK-18124, file 
stream sink should logically supports aggregation + watermark + append mode. 
But actually it fails with
    ```
    16:23:07.389 ERROR 
org.apache.spark.sql.execution.streaming.StreamExecution: Query query-0 
terminated with error
    java.lang.AssertionError: assertion failed: No plan for EventTimeWatermark 
timestamp#7: timestamp, interval 10 seconds
    +- LocalRelation [timestamp#7]
    
        at scala.Predef$.assert(Predef.scala:170)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:92)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:77)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:74)
        at 
scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
        at 
scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
        at scala.collection.Iterator$class.foreach(Iterator.scala:893)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
        at 
scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
        at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:74)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:66)
        at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
        at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:92)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:77)
        at 
org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:74)
    ```
    
    This PR fixes it by passing the correct query execution.
    
    ## How was this patch tested?
    New unit test


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tdas/spark SPARK-18440

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/15885.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15885
    
----
commit 337ef01d06237b613d04011795b73c564b4b3e54
Author: Tathagata Das <tathagata.das1...@gmail.com>
Date:   2016-11-15T00:48:47Z

    Pass correct query execution to FileFormatWriter

----


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