Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/12960#discussion_r62537311 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala --- @@ -59,17 +59,48 @@ class InMemoryCatalog extends ExternalCatalog { } } + private def requireFunctionNotExists(db: String, funcName: String): Unit = { + if (functionExists(db, funcName)) { + throw new AnalysisException( + s"Function already exists: '$funcName' exists in database '$db'") + } + } + private def requireTableExists(db: String, table: String): Unit = { if (!tableExists(db, table)) { throw new AnalysisException( s"Table or view not found: '$table' does not exist in database '$db'") } } - private def requirePartitionExists(db: String, table: String, spec: TablePartitionSpec): Unit = { - if (!partitionExists(db, table, spec)) { + private def requireTableNotExists(db: String, table: String): Unit = { + if (tableExists(db, table)) { throw new AnalysisException( - s"Partition not found: database '$db' table '$table' does not contain: '$spec'") + s"Table or view exists: '$table' exists in database '$db'") + } + } + + private def requirePartitionsExist( + db: String, + table: String, + specs: Seq[TablePartitionSpec]): Unit = { + specs foreach { s => --- End diff -- style: `specs.foreach`
--- 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