Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address Herman's comments and fix lints
  • Loading branch information
heyihong committed Nov 8, 2023
commit 495f070a5c133ad8b3f53a15a17f5475f3eeaa3c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import scala.util.control.NonFatal

import org.apache.spark.sql._
import org.apache.spark.sql.catalog.{Catalog, CatalogMetadata, Column, Database, Function, Table}
import org.apache.spark.sql.catalyst.{DefinedByConstructorParams, FunctionIdentifier, TableIdentifier}
import org.apache.spark.sql.catalyst.{DefinedByConstructorParams, TableIdentifier}
import org.apache.spark.sql.catalyst.analysis._
import org.apache.spark.sql.catalyst.catalog._
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.expressions.{Expression, Literal}
import org.apache.spark.sql.catalyst.plans.logical.{CreateTable, LocalRelation, LogicalPlan, OptionList, RecoverPartitions, ShowFunctions, ShowNamespaces, ShowTables, UnresolvedTableSpec, View}
import org.apache.spark.sql.catalyst.types.DataTypeUtils
import org.apache.spark.sql.connector.catalog.{CatalogManager, CatalogPlugin, CatalogV2Util, FunctionCatalog, Identifier, SupportsNamespaces, Table => V2Table, TableCatalog, V1Table}
import org.apache.spark.sql.connector.catalog.{CatalogManager, CatalogPlugin, CatalogV2Util, Identifier, SupportsNamespaces, Table => V2Table, TableCatalog, V1Table}
import org.apache.spark.sql.connector.catalog.CatalogV2Implicits.{CatalogHelper, MultipartIdentifierHelper, NamespaceHelper, TransformHelper}
import org.apache.spark.sql.errors.QueryCompilationErrors
import org.apache.spark.sql.execution.command.ShowTablesCommand
Expand Down Expand Up @@ -297,8 +297,9 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
}
}

private def functionExists(nameParts: Seq[String]): Boolean = {
val plan = UnresolvedFunctionName(nameParts, "Catalog.functionExists", false, None)
private def functionExists(ident: Seq[String]): Boolean = {
val plan =
UnresolvedFunctionName(ident, CatalogImpl.FUNCTION_EXISTS_COMMAND_NAME, false, None)
try {
sparkSession.sessionState.executePlan(plan).analyzed match {
case _: ResolvedPersistentFunc => true
Expand Down Expand Up @@ -951,4 +952,5 @@ private[sql] object CatalogImpl {
new Dataset[T](queryExecution, enc)
}

private val FUNCTION_EXISTS_COMMAND_NAME = "Catalog.functionExists"
}