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

    https://github.com/apache/spark/pull/12117#discussion_r58473230
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/commands.scala 
---
    @@ -396,18 +400,16 @@ case class ShowFunctions(db: Option[String], pattern: 
Option[String]) extends Ru
         schema.toAttributes
       }
     
    -  override def run(sqlContext: SQLContext): Seq[Row] = pattern match {
    -    case Some(p) =>
    -      try {
    -        val regex = java.util.regex.Pattern.compile(p)
    -        sqlContext.sessionState.functionRegistry.listFunction()
    -          .filter(regex.matcher(_).matches()).map(Row(_))
    -      } catch {
    -        // probably will failed in the regex that user provided, then 
returns empty row.
    -        case _: Throwable => Seq.empty[Row]
    -      }
    -    case None =>
    -      sqlContext.sessionState.functionRegistry.listFunction().map(Row(_))
    +  override def run(sqlContext: SQLContext): Seq[Row] = {
    +    val dbName = 
db.getOrElse(sqlContext.sessionState.catalog.getCurrentDatabase)
    +    val functionNames =
    +      sqlContext.sessionState.catalog
    +        .listFunctions(dbName, pattern.getOrElse(".*"))
    --- End diff --
    
    oh, I was confused last time when I was trying to figure out the syntax.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to