GitHub user lw-lin opened a pull request: https://github.com/apache/spark/pull/12521
[SPARK-14747][SQL] Add assertStreaming/assertNoneStreaming checks in DataFrameWriter ## Problem If an end user happens to write code mixed with continuous-query-oriented methods and non-continuous-query-oriented methods: ```scala ctx.read .format("text") .stream("...") // continuous query .write .text("...") // non-continuous query; should be startStream() here ``` He/she would get this somehow confusing exception: > Exception in thread "main" java.lang.AssertionError: assertion failed: No plan for FileSource[./continuous_query_test_input] at scala.Predef$.assert(Predef.scala:170) at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:59) at org.apache.spark.sql.catalyst.planning.QueryPlanner.planLater(QueryPlanner.scala:54) at ... ## What changes were proposed in this pull request? This PR adds checks for continuous-query-oriented methods and non-continuous-query-oriented methods in `DataFrameWriter`: <table> <tr> <td align="center"></td> <td align="center"><strong>continuous query</strong></td> <td align="center"><strong>non-continuous query</strong></td> </tr> <tr> <td align="center">mode</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">trigger</td> <td align="center">â</td> <td align="center"></td> </tr> <tr> <td align="center">format</td> <td align="center">â</td> <td align="center">â</td> </tr> <tr> <td align="center">option/options</td> <td align="center">â</td> <td align="center">â</td> </tr> <tr> <td align="center">partitionBy</td> <td align="center">â</td> <td align="center">â</td> </tr> <tr> <td align="center">bucketBy</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">sortBy</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">save</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">queryName</td> <td align="center">â</td> <td align="center"></td> </tr> <tr> <td align="center">startStream</td> <td align="center">â</td> <td align="center"></td> </tr> <tr> <td align="center">insertInto</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">saveAsTable</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">jdbc</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">json</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">parquet</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">orc</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">text</td> <td align="center"></td> <td align="center">â</td> </tr> <tr> <td align="center">csv</td> <td align="center"></td> <td align="center">â</td> </tr> </table> ## How was this patch tested? dedicated unit tests were added You can merge this pull request into a Git repository by running: $ git pull https://github.com/lw-lin/spark dataframe-writer-check Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12521.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 #12521 ---- commit 449b7bd204970311b26638e1b8bc0de3d4faaa8c Author: Liwei Lin <lwl...@gmail.com> Date: 2016-04-20T05:58:05Z add checks for continuous-queries-oriented methods / non-continuous-queries-oriented methods ---- --- 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