Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15640#discussion_r85213183
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
 ---
    @@ -220,4 +220,12 @@ class SparkSqlParserSuite extends PlanTest {
     
         intercept("explain describe tables x", "Unsupported SQL statement")
       }
    +
    +  test("SPARK-18106 analyze table") {
    --- End diff --
    
    Thank you. But, the parse test should be rewritten. Is it okay? Those 
testcase uses `assertAnalyzeCommand` using SparkSession and looks like the 
following.
    ```scala
        def assertAnalyzeCommand(analyzeCommand: String, c: Class[_]) {
          val parsed = spark.sessionState.sqlParser.parsePlan(analyzeCommand)
          val operators = parsed.collect {
            case a: AnalyzeTableCommand => a
            case o => o
          }
    
          assert(operators.size === 1)
          if (operators(0).getClass() != c) {
            fail(
              s"""$analyzeCommand expected command: $c, but got ${operators(0)}
                 |parsed command:
                 |$parsed
               """.stripMargin)
          }
        }
    
        assertAnalyzeCommand(
          "ANALYZE TABLE Table1 COMPUTE STATISTICS",
          classOf[AnalyzeTableCommand])
    ```


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