Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17182#discussion_r104718115
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -1937,19 +1937,6 @@ def test_list_functions(self):
                 className="org.apache.spark.sql.catalyst.expressions.Add",
                 isTemporary=True))
             self.assertEquals(functions, functionsDefault)
    -        spark.catalog.registerFunction("temp_func", lambda x: str(x))
    -        spark.sql("CREATE FUNCTION func1 AS 
'org.apache.spark.data.bricks'")
    --- End diff --
    
    Thank you for review, @holdenk .
    
    It's because the current Spark shows the following misleading UX. Users see 
the registered function by `SHOW FUNCTIONS`, but they also meet `Undefined 
function` exceptions together. I updated the PR description too.
    
    ```
    scala> sql("CREATE FUNCTION function_with_invalid_classname AS 
'org.invalid'").show
    ++
    ||
    ++
    ++
    
    scala> sql("show functions like 'function_*'").show(false)
    +---------------------------------------+
    |function                               |
    +---------------------------------------+
    |default.function_with_invalid_classname|
    +---------------------------------------+
    
    scala> sql("select function_with_invalid_classname()").show
    org.apache.spark.sql.AnalysisException: Undefined function: 
'function_with_invalid_classname'. This function is neither a registered 
temporary function nor a permanent function registered in the database 
'default'.; line 1 pos 7
    ```
    
    Also, this is consistent with `CREATE TEMPORARY FUNCTION` behavior, too.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to