Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12618#discussion_r62598308
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -93,6 +95,41 @@ class SessionCatalog(
       }
     
       /**
    +   * Checks if the given name conforms the Hive standard ("[a-zA-z_0-9]+"),
    +   * i.e. if this name only contains characters, numbers, and _.
    +   *
    +   * This method is intended to have the same behavior of
    +   * org.apache.hadoop.hive.metastore.MetaStoreUtils.validateName.
    +   */
    +  protected[this] def validateName(name: String): Boolean = {
    +    validName.pattern.matcher(name).matches()
    +  }
    +
    +  /**
    +   * Validate database names
    +   */
    +  def validateDatabaseName(dbName: Option[String]): Unit = {
    +    if (dbName.isDefined) validateDatabaseName(dbName.get)
    +  }
    +
    +  def validateDatabaseName(dbName: String): Unit = {
    +    if (!validateName(dbName)) {
    +      throw new AnalysisException(s"Database name '$dbName' is not a valid 
name. " +
    +        s"Valid database names only contain characters, numbers and _.")
    +    }
    +  }
    +
    +  /**
    +   * Validate table names
    +   */
    --- End diff --
    
    Sure, will do it.


---
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]

Reply via email to