Github user dongjoon-hyun commented on a diff in the pull request: https://github.com/apache/spark/pull/15640#discussion_r85212670 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala --- @@ -220,4 +220,13 @@ class SparkSqlParserSuite extends PlanTest { intercept("explain describe tables x", "Unsupported SQL statement") } + + test("SPARK-18106 analyze table") { + assertEqual("analyze table t compute statistics", + AnalyzeTableCommand(TableIdentifier("t"), noscan = false)) + assertEqual("analyze table t compute statistics noscan", + AnalyzeTableCommand(TableIdentifier("t"), noscan = true)) + intercept("analyze table t compute statistics xxxx", "Expected `NOSCAN` instead of `xxxx`") + intercept("analyze table t partition (a) compute statistics xxxx") --- 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