diff --git a/core/src/main/resources/error/error-classes.json b/core/src/main/resources/error/error-classes.json index 408c97acaa39c..3dba15c6584c6 100644 --- a/core/src/main/resources/error/error-classes.json +++ b/core/src/main/resources/error/error-classes.json @@ -1041,7 +1041,7 @@ }, "INVALID_TEMP_OBJ_REFERENCE" : { "message" : [ - "Cannot create a persistent by referencing a temporary . Please make the temporary persistent, or make the persistent temporary." + "Cannot create the persistent object of the type because it references to the temporary object of the type . Please make the temporary object persistent, or make the persistent object temporary." ] }, "INVALID_TYPED_LITERAL" : { diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala index 1c257966aaf4b..e4475980cf934 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala @@ -2692,9 +2692,9 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase { new AnalysisException( errorClass = "INVALID_TEMP_OBJ_REFERENCE", messageParameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> toSQLId(name.nameParts), - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> toSQLId(nameParts))) } @@ -2704,9 +2704,9 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase { new AnalysisException( errorClass = "INVALID_TEMP_OBJ_REFERENCE", messageParameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> toSQLId(name.nameParts), - "tempObj" -> "function", + "tempObj" -> "FUNCTION", "tempObjName" -> toSQLId(funcName))) } diff --git a/sql/core/src/test/resources/sql-tests/results/postgreSQL/create_view.sql.out b/sql/core/src/test/resources/sql-tests/results/postgreSQL/create_view.sql.out index 2768f7b53b4a3..59e574c27e3ee 100644 --- a/sql/core/src/test/resources/sql-tests/results/postgreSQL/create_view.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/postgreSQL/create_view.sql.out @@ -280,9 +280,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v1_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -344,9 +344,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v3_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -401,9 +401,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v4_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -421,9 +421,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v5_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -588,9 +588,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v6_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -605,9 +605,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v7_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -622,9 +622,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v8_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -639,9 +639,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`temp_view_test`.`v9_temp`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`temp_table`" } } @@ -795,9 +795,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`testviewschm2`.`temporal1`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`tt`" } } @@ -844,9 +844,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`testviewschm2`.`temporal2`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`tt`" } } @@ -893,9 +893,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`testviewschm2`.`temporal3`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`tt`" } } @@ -942,9 +942,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`testviewschm2`.`temporal4`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`tt`" } } @@ -959,9 +959,9 @@ org.apache.spark.sql.AnalysisException { "errorClass" : "INVALID_TEMP_OBJ_REFERENCE", "messageParameters" : { - "obj" : "view", + "obj" : "VIEW", "objName" : "`spark_catalog`.`testviewschm2`.`temporal5`", - "tempObj" : "view", + "tempObj" : "VIEW", "tempObjName" : "`tt`" } } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala index 377be2e720aff..123364f18ceb4 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala @@ -3972,9 +3972,9 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark exception = e, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`$testViewName`", - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> s"`$tempViewName`")) val e2 = intercept[AnalysisException] { @@ -3991,9 +3991,9 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark exception = e2, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`$testViewName`", - "tempObj" -> "function", + "tempObj" -> "FUNCTION", "tempObjName" -> s"`$tempFuncName`")) } } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala index 85984f1b2a835..122e3bdd854ed 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala @@ -2408,9 +2408,9 @@ class DataSourceV2SQLSuiteV1Filter }, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> "`spark_catalog`.`default`.`v`", - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> "`t`")) } } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala index 26b0e7657005b..8cb91d3b754fc 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala @@ -87,9 +87,9 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { }, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`jtv1`", - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> "`temp_jtv1`")) val globalTempDB = spark.sharedState.globalTempViewManager.database sql("CREATE GLOBAL TEMP VIEW global_temp_jtv1 AS SELECT * FROM jt WHERE id > 0") @@ -99,9 +99,9 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { }, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`jtv1`", - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> "`global_temp`.`global_temp_jtv1`")) } } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala index 34dfdf12357a1..4e89d6fdf5ec8 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala @@ -616,9 +616,9 @@ class PersistedViewTestSuite extends SQLViewTestSuite with SharedSparkSession { }, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`v1`", - "tempObj" -> "view", + "tempObj" -> "VIEW", "tempObjName" -> "`v2`")) val tempFunctionName = "temp_udf" val functionClass = "test.org.apache.spark.sql.MyDoubleAvg" @@ -630,9 +630,9 @@ class PersistedViewTestSuite extends SQLViewTestSuite with SharedSparkSession { }, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`v1`", - "tempObj" -> "function", + "tempObj" -> "FUNCTION", "tempObjName" -> s"`$tempFunctionName`")) } } diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala index bf4954eeb1e6a..8b7f7ade560ad 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala @@ -88,9 +88,9 @@ class HiveSQLViewSuite extends SQLViewSuite with TestHiveSingleton { exception = e, errorClass = "INVALID_TEMP_OBJ_REFERENCE", parameters = Map( - "obj" -> "view", + "obj" -> "VIEW", "objName" -> s"`$SESSION_CATALOG_NAME`.`default`.`view1`", - "tempObj" -> "function", + "tempObj" -> "FUNCTION", "tempObjName" -> s"`$tempFunctionName`")) } }