Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16018#discussion_r89684361
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
---
@@ -309,32 +309,17 @@ case class PreWriteCheck(conf: SQLConf, catalog:
SessionCatalog)
def failAnalysis(msg: String): Unit = { throw new AnalysisException(msg)
}
- // This regex is used to check if the table name and database name is
valid for `CreateTable`.
- private val validNameFormat = Pattern.compile("[\\w_]+")
-
def apply(plan: LogicalPlan): Unit = {
plan.foreach {
case c @ CreateTable(tableDesc, mode, query) if c.resolved =>
- // Since we are saving table metadata to metastore, we should make
sure the table name
- // and database name don't break some common restrictions, e.g.
special chars except
- // underscore are not allowed.
- val tblIdent = tableDesc.identifier
- if (!validNameFormat.matcher(tblIdent.table).matches()) {
- failAnalysis(s"Table name ${tblIdent.table} is not a valid name
for " +
- s"metastore. Metastore only accepts table name containing
characters, numbers and _.")
- }
- if (tblIdent.database.exists(db =>
!validNameFormat.matcher(db).matches())) {
- failAnalysis(s"Database name ${tblIdent.database.get} is not a
valid name for " +
- s"metastore. Metastore only accepts table name containing
characters, numbers and _.")
- }
if (query.isDefined &&
- mode == SaveMode.Overwrite &&
- catalog.tableExists(tableDesc.identifier)) {
+ mode == SaveMode.Overwrite &&
--- End diff --
Fixed. : )
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]