zhengruifeng commented on code in PR #37039:
URL: https://github.com/apache/spark/pull/37039#discussion_r912318495


##########
python/pyspark/sql/catalog.py:
##########
@@ -139,11 +140,40 @@ def listDatabases(self) -> List[Database]:
             jdb = iter.next()
             databases.append(
                 Database(
-                    name=jdb.name(), description=jdb.description(), 
locationUri=jdb.locationUri()
+                    name=jdb.name(),
+                    catalog=jdb.catalog(),
+                    description=jdb.description(),
+                    locationUri=jdb.locationUri(),
                 )
             )
         return databases
 
+    def getDatabase(self, dbName: str) -> Database:
+        """Get the database with the specified name.
+        This throws an AnalysisException when the database cannot be found.
+
+        .. versionadded:: 3.4.0
+
+        Parameters
+        ----------
+        dbName : str
+             name of the database to check existence.
+
+        Examples
+        --------
+        >>> spark.catalog.getDatabase("default")
+        Database(name='default', catalog=None, description='default database', 
...

Review Comment:
   because of the old code path, which intilize a `Database` with `null` 
catalog:
   
   
https://github.com/apache/spark/pull/36968/files#diff-d7036fd31ee9734405f0e877b79e36675d567b6f9acb844034383463e80a54ccR65-R67



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to