zhengruifeng commented on code in PR #36977:
URL: https://github.com/apache/spark/pull/36977#discussion_r913618683
##########
python/pyspark/sql/catalog.py:
##########
@@ -288,19 +301,75 @@ def functionExists(self, functionName: str, dbName:
Optional[str] = None) -> boo
name of the database to check function existence in.
If no database is specified, the current database is used
+ .. deprecated:: 3.4.0
+
+
Returns
-------
bool
Indicating whether the function exists
+ .. versionchanged:: 3.4
+ Allowed ``functionName`` to be qualified with catalog name
+
Examples
--------
>>> spark.catalog.functionExists("unexisting_function")
False
+ >>> spark.catalog.functionExists("default.unexisting_function")
+ False
+ >>>
spark.catalog.functionExists("spark_catalog.default.unexisting_function")
+ False
"""
if dbName is None:
- dbName = self.currentDatabase()
- return self._jcatalog.functionExists(dbName, functionName)
+ return self._jcatalog.functionExists(functionName)
+ else:
+ warnings.warn(
+ "`dbName` has been deprecated since Spark 3.4 and might be
removed in "
+ "a future version. Use functionExists(`dbName.tableName`)
instead.",
+ FutureWarning,
+ )
+ return self._jcatalog.functionExists(self.currentDatabase(),
functionName)
Review Comment:
oops, here should be `self._jcatalog.functionExists(dbName, functionName)`
let me fix it in a follow up
--
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]