Skip to content
Prev Previous commit
[SPARK-22954][SQL] Add test case to make sure that calling analyze pa…
…rtition on view throws AnalyzeException telling that it isn't supported on views.
  • Loading branch information
su225 committed Jan 30, 2018
commit 4c8645623f3b89c9f7b1bc7809c6b9f5a95d2389
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
}
}

test("SPARK-22954 - Issue AnalysisException when analysis is run on view") {
test("SPARK-22954 - Issue AnalysisException when ANALYZE is run on view") {
val viewName = "testView"
val analyzeNotSupportedOnViewsMsg = "ANALYZE TABLE is not supported on views."
withTempView(viewName) {
Expand All @@ -170,6 +170,10 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
assert(intercept[AnalysisException] {
sql(s"ANALYZE TABLE $viewName COMPUTE STATISTICS FOR COLUMNS id")
}.getMessage.contains(analyzeNotSupportedOnViewsMsg))

assert(intercept[AnalysisException] {
sql(s"ANALYZE TABLE $viewName PARTITION (a) COMPUTE STATISTICS")
}.getMessage.contains(analyzeNotSupportedOnViewsMsg))
}
}

Expand Down