Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,11 @@
"AES-<mode> with the padding <padding> by the <functionName> function."
]
},
"ANALYZE_UNCACHED_TEMP_VIEW" : {
"message" : [
"The ANALYZE TABLE FOR COLUMNS command can operate on temporary views that have been cached already. Consider to cache the view <viewName>."
]
},
"CATALOG_OPERATION" : {
"message" : [
"Catalog <catalogName> does not support <operation>."
Expand Down Expand Up @@ -2868,11 +2873,6 @@
"Partition spec is invalid. The spec (<specKeys>) must match the partition spec (<partitionColumnNames>) defined in table '<tableName>'."
]
},
"_LEGACY_ERROR_TEMP_1234" : {
"message" : [
"Temporary view <tableIdent> is not cached for analyzing columns."
]
},
"_LEGACY_ERROR_TEMP_1235" : {
"message" : [
"Column <name> in table <tableIdent> is of type <dataType>, and Spark does not support statistics collection on this column type."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,8 +2287,8 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {

def tempViewNotCachedForAnalyzingColumnsError(tableIdent: TableIdentifier): Throwable = {
new AnalysisException(
errorClass = "_LEGACY_ERROR_TEMP_1234",
messageParameters = Map("tableIdent" -> tableIdent.toString))
errorClass = "UNSUPPORTED_FEATURE.ANALYZE_UNCACHED_TEMP_VIEW",
messageParameters = Map("viewName" -> toSQLId(tableIdent.toString)))
}

def columnTypeNotSupportStatisticsCollectionError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,13 @@ class StatisticsCollectionSuite extends StatisticsCollectionTestBase with Shared
withTempView("tempView") {
// Analyzes in a temporary view
sql("CREATE TEMPORARY VIEW tempView AS SELECT 1 id")
val errMsg = intercept[AnalysisException] {
sql("ANALYZE TABLE tempView COMPUTE STATISTICS FOR COLUMNS id")
}.getMessage
assert(errMsg.contains("Temporary view `tempView` is not cached for analyzing columns"))
checkError(
exception = intercept[AnalysisException] {
sql("ANALYZE TABLE tempView COMPUTE STATISTICS FOR COLUMNS id")
},
errorClass = "UNSUPPORTED_FEATURE.ANALYZE_UNCACHED_TEMP_VIEW",
parameters = Map("viewName" -> "`tempView`")
)

// Cache the view then analyze it
sql("CACHE TABLE tempView")
Expand All @@ -604,11 +607,13 @@ class StatisticsCollectionSuite extends StatisticsCollectionTestBase with Shared
ExpectedContext(s"$globalTempDB.gTempView", 14, 13 + s"$globalTempDB.gTempView".length))
// Analyzes in a global temporary view
sql("CREATE GLOBAL TEMP VIEW gTempView AS SELECT 1 id")
val errMsg2 = intercept[AnalysisException] {
sql(s"ANALYZE TABLE $globalTempDB.gTempView COMPUTE STATISTICS FOR COLUMNS id")
}.getMessage
assert(errMsg2.contains(
s"Temporary view `$globalTempDB`.`gTempView` is not cached for analyzing columns"))
checkError(
exception = intercept[AnalysisException] {
sql(s"ANALYZE TABLE $globalTempDB.gTempView COMPUTE STATISTICS FOR COLUMNS id")
},
errorClass = "UNSUPPORTED_FEATURE.ANALYZE_UNCACHED_TEMP_VIEW",
parameters = Map("viewName" -> "`global_temp`.`gTempView`")
)

// Cache the view then analyze it
sql(s"CACHE TABLE $globalTempDB.gTempView")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,13 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
}.getMessage
assert(e4.contains(
s"$viewName is a temp view. 'ANALYZE TABLE' expects a table or permanent view."))
val e5 = intercept[AnalysisException] {
sql(s"ANALYZE TABLE $viewName COMPUTE STATISTICS FOR COLUMNS id")
}.getMessage
assert(e5.contains(s"Temporary view `$viewName` is not cached for analyzing columns."))
checkError(
exception = intercept[AnalysisException] {
sql(s"ANALYZE TABLE $viewName COMPUTE STATISTICS FOR COLUMNS id")
},
errorClass = "UNSUPPORTED_FEATURE.ANALYZE_UNCACHED_TEMP_VIEW",
parameters = Map("viewName" -> "`testView`")
)
}
}

Expand Down