diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala index 0e74eff7f5af8..0c62bb2beefb1 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala @@ -2687,7 +2687,7 @@ object DatePart { errorHandleFunc: => Nothing): Expression = extractField.toUpperCase(Locale.ROOT) match { case "YEAR" | "Y" | "YEARS" | "YR" | "YRS" => Year(source) case "YEAROFWEEK" => YearOfWeek(source) - case "QUARTER" | "QTR" => Quarter(source) + case "QUARTER" | "QTR" | "Q" => Quarter(source) case "MONTH" | "MON" | "MONS" | "MONTHS" => Month(source) case "WEEK" | "W" | "WEEKS" => WeekOfYear(source) case "DAY" | "D" | "DAYS" => DayOfMonth(source) diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala index 5f4f2f36b5969..4f6fc4dc21376 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala @@ -139,11 +139,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat s"as table property keys may not start with '$SPARK_SQL_PREFIX': " + invalidKeys.mkString("[", ", ", "]")) } - // External users are not allowed to set/switch the table type. In Hive metastore, the table - // type can be switched by changing the value of a case-sensitive table property `EXTERNAL`. - if (table.properties.contains("EXTERNAL")) { - throw new AnalysisException("Cannot set or change the preserved property key: 'EXTERNAL'") - } + // To keep the parity with Hive, the check for external table properties has been removed. } /** diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala index 6d8938b387e53..a3c5968cd6541 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala @@ -821,7 +821,7 @@ class HiveDDLSuite s"$tableName is a table. '$cmdName' expects a view. Please use ALTER TABLE instead.") } - test("create table - SET TBLPROPERTIES EXTERNAL to TRUE") { + ignore("create table - SET TBLPROPERTIES EXTERNAL to TRUE") { val tabName = "tab1" withTable(tabName) { assertAnalysisError( @@ -830,7 +830,7 @@ class HiveDDLSuite } } - test("alter table - SET TBLPROPERTIES EXTERNAL to TRUE") { + ignore("alter table - SET TBLPROPERTIES EXTERNAL to TRUE") { val tabName = "tab1" withTable(tabName) { val catalog = spark.sessionState.catalog