Skip to content

Commit

Permalink
Trunc function does not contain the Q string (for quarter) (#45)
Browse files Browse the repository at this point in the history
* Revert "[SPARK-17658][SQL] Disallow Users to Change Table Type"

This reverts commit [SPARK-17657][SQL] Disallow Users to Change Table Type.

* Trunc function does not contain the Q string (for quarter)

* Add comment for disabling the external table check

* Ignore tests instead of removing them
  • Loading branch information
catalinii authored Jan 24, 2022
1 parent 98901e8 commit abf236a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit abf236a

Please sign in to comment.