You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2019/03/07 04:06:41 UTC

[spark] branch master updated: [MINOR][SQL][TEST] Include usage example for generating output for single test in SQLQueryTestSuite

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new a0e26cf  [MINOR][SQL][TEST] Include usage example for generating output for single test in SQLQueryTestSuite
a0e26cf is described below

commit a0e26cffc5c0163a780e86d37183b0cebbc7b24c
Author: Dilip Biswal <db...@us.ibm.com>
AuthorDate: Thu Mar 7 13:06:23 2019 +0900

    [MINOR][SQL][TEST] Include usage example for generating output for single test in SQLQueryTestSuite
    
    ## What changes were proposed in this pull request?
    This is a very minor pr to include the usage example to generate output for single test in SQLQueryTestSuite. I tried to deduce it from the existing example and ran into a scenario
    where sbt is simply looping to run the same test over and over again. Here is the example
    of running a single test.
    
    ```
    build/sbt "~sql/test-only *SQLQueryTestSuite -- -z inline-table.sql"
    ```
    I tried to generate the output for a single test by prepending `SPARK_GENERATE_GOLDEN_FILES=1` like following
    ```
    SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "~sql/test-only *SQLQueryTestSuite -- -z describe.sql"
    ```
    In this case i found that sbt is looping trying to run describe.sql over and over again as we are running the test in on continuous mode (because of `~` prefix ) where it detects a change in
    the generated result file which in turn triggers a build and test. I have included an example where
    we don't run it in continuous mode when generating the output. Hopefully it saves other developers some time.
    ## How was this patch tested?
    Verified manually in my dev setup.
    
    Closes #23995 from dilipbiswal/dkb_sqlquerytest_usage.
    
    Authored-by: Dilip Biswal <db...@us.ibm.com>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 .../src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
index 62f3f98..d45ceca 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
@@ -48,11 +48,16 @@ import org.apache.spark.sql.types.StructType
  *   build/sbt "~sql/test-only *SQLQueryTestSuite -- -z inline-table.sql"
  * }}}
  *
- * To re-generate golden files, run:
+ * To re-generate golden files for entire suite, run:
  * {{{
  *   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/test-only *SQLQueryTestSuite"
  * }}}
  *
+ * To re-generate golden file for a single test, run:
+ * {{{
+ *   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/test-only *SQLQueryTestSuite -- -z describe.sql"
+ * }}}
+ *
  * The format for input files is simple:
  *  1. A list of SQL queries separated by semicolon.
  *  2. Lines starting with -- are treated as comments and ignored.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org