@@ -69,19 +69,20 @@ class InMemoryCatalog extends ExternalCatalog {
6969
7070 private def requireFunctionExists (db : String , funcName : String ): Unit = {
7171 if (! existsFunction(db, funcName)) {
72- throw new AnalysisException (s " Function $funcName does not exist in $db database " )
72+ throw new AnalysisException (s " Function ' $funcName' does not exist in database ' $db' " )
7373 }
7474 }
7575
7676 private def requireTableExists (db : String , table : String ): Unit = {
7777 if (! existsTable(db, table)) {
78- throw new AnalysisException (s " Table $table does not exist in $db database " )
78+ throw new AnalysisException (s " Table ' $table' does not exist in database ' $db' " )
7979 }
8080 }
8181
8282 private def requirePartitionExists (db : String , table : String , spec : TablePartitionSpec ): Unit = {
8383 if (! existsPartition(db, table, spec)) {
84- throw new AnalysisException (s " Partition does not exist in database $db table $table: $spec" )
84+ throw new AnalysisException (
85+ s " Partition does not exist in database ' $db' table ' $table': ' $spec' " )
8586 }
8687 }
8788
@@ -94,7 +95,7 @@ class InMemoryCatalog extends ExternalCatalog {
9495 ignoreIfExists : Boolean ): Unit = synchronized {
9596 if (catalog.contains(dbDefinition.name)) {
9697 if (! ignoreIfExists) {
97- throw new AnalysisException (s " Database ${dbDefinition.name} already exists. " )
98+ throw new AnalysisException (s " Database ' ${dbDefinition.name}' already exists." )
9899 }
99100 } else {
100101 catalog.put(dbDefinition.name, new DatabaseDesc (dbDefinition))
@@ -109,17 +110,17 @@ class InMemoryCatalog extends ExternalCatalog {
109110 if (! cascade) {
110111 // If cascade is false, make sure the database is empty.
111112 if (catalog(db).tables.nonEmpty) {
112- throw new AnalysisException (s " Database $db is not empty. One or more tables exist. " )
113+ throw new AnalysisException (s " Database ' $db' is not empty. One or more tables exist." )
113114 }
114115 if (catalog(db).functions.nonEmpty) {
115- throw new AnalysisException (s " Database $db is not empty. One or more functions exist. " )
116+ throw new AnalysisException (s " Database ' $db' is not empty. One or more functions exist." )
116117 }
117118 }
118119 // Remove the database.
119120 catalog.remove(db)
120121 } else {
121122 if (! ignoreIfNotExists) {
122- throw new AnalysisException (s " Database $db does not exist " )
123+ throw new AnalysisException (s " Database ' $db' does not exist" )
123124 }
124125 }
125126 }
@@ -160,7 +161,7 @@ class InMemoryCatalog extends ExternalCatalog {
160161 val table = tableDefinition.name.table
161162 if (existsTable(db, table)) {
162163 if (! ignoreIfExists) {
163- throw new AnalysisException (s " Table $table already exists in $db database " )
164+ throw new AnalysisException (s " Table ' $table' already exists in database ' $db' " )
164165 }
165166 } else {
166167 catalog(db).tables.put(table, new TableDesc (tableDefinition))
@@ -224,8 +225,8 @@ class InMemoryCatalog extends ExternalCatalog {
224225 val dupSpecs = parts.collect { case p if existingParts.contains(p.spec) => p.spec }
225226 if (dupSpecs.nonEmpty) {
226227 val dupSpecsStr = dupSpecs.mkString(" \n ===\n " )
227- throw new AnalysisException (
228- s " The following partitions already exist in database $db table $table: \n $dupSpecsStr" )
228+ throw new AnalysisException (" The following partitions already exist in database " +
229+ s " ' $db' table ' $table' :\n $dupSpecsStr" )
229230 }
230231 }
231232 parts.foreach { p => existingParts.put(p.spec, p) }
@@ -242,8 +243,8 @@ class InMemoryCatalog extends ExternalCatalog {
242243 val missingSpecs = partSpecs.collect { case s if ! existingParts.contains(s) => s }
243244 if (missingSpecs.nonEmpty) {
244245 val missingSpecsStr = missingSpecs.mkString(" \n ===\n " )
245- throw new AnalysisException (
246- s " The following partitions do not exist in database $db table $table: \n $missingSpecsStr" )
246+ throw new AnalysisException (" The following partitions do not exist in database " +
247+ s " ' $db' table ' $table' :\n $missingSpecsStr" )
247248 }
248249 }
249250 partSpecs.foreach(existingParts.remove)
@@ -295,7 +296,7 @@ class InMemoryCatalog extends ExternalCatalog {
295296 override def createFunction (db : String , func : CatalogFunction ): Unit = synchronized {
296297 requireDbExists(db)
297298 if (existsFunction(db, func.name.funcName)) {
298- throw new AnalysisException (s " Function $func already exists in $db database " )
299+ throw new AnalysisException (s " Function ' $func' already exists in ' $db' database" )
299300 } else {
300301 catalog(db).functions.put(func.name.funcName, func)
301302 }
0 commit comments