ABHISHEK KUMAR GUPTA created SPARK-28671:
--------------------------------------------

             Summary: [UDF] dropping permanent function when a temporary 
function with the same name already exists giving wrong msg on dropping it again
                 Key: SPARK-28671
                 URL: https://issues.apache.org/jira/browse/SPARK-28671
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.4.0
            Reporter: ABHISHEK KUMAR GUPTA


Created jar and uploaded at hdfs path
1.      ./hdfs dfs -put /opt/trash1/AddDoublesUDF.jar /user/user1/
2.      Launch beeline and created permanent function
CREATE FUNCTION addDoubles AS 
'com.huawei.bigdata.hive.example.udf.AddDoublesUDF' using jar 
'hdfs://hacluster/user/user1/AddDoublesUDF.jar';
3.      Perform select operation
jdbc:hive2://100.100.208.125:23040/default> SELECT addDoubles(1,2,3);
+------------------------------+--+
| default.addDoubles(1, 2, 3)  |
+------------------------------+--+
| 6.0                          |
+------------------------------+--+
1 row selected (0.111 seconds)
4.      Created temporary function as below
jdbc:hive2://100.100.208.125:23040/default> CREATE temporary FUNCTION 
addDoubles AS 'com.huawei.bigdata.hive.example.udf.AddDoublesUDF' using jar 
'hdfs://hacluster/user/user1/AddDoublesUDF.jar';
5.      jdbc:hive2://100.100.208.125:23040/default> SELECT addDoubles(1,2,3);
+----------------------+--+
| addDoubles(1, 2, 3)  |
+----------------------+--+
| 6.0                  |
+----------------------+--+
1 row selected (0.088 seconds)
6.      Drop function
jdbc:hive2://100.100.208.125:23040/default> drop function addDoubles;
+---------+--+
| Result  |
+---------+--+
+---------+--+
7.      jdbc:hive2://100.100.208.125:23040/default> SELECT addDoubles(1,2,3); 
-- It is success
8.      Drop again Error thrown
jdbc:hive2://100.100.208.125:23040/default> drop function addDoubles;
Error: org.apache.spark.sql.catalyst.analysis.NoSuchFunctionException: 
Undefined function: 'default.addDoubles'. This function is neither a registered 
temporary function nor a permanent function registered in the database 
'default'.; (state=,code=0)

9.      Perform again select 
jdbc:hive2://100.100.208.125:23040/default>  SELECT addDoubles(1,2,3);
+----------------------+--+
| addDoubles(1, 2, 3)  |
+----------------------+--+
| 6.0                  |
        

Issue is why the Error msg shown is step 8 saying it is neither registered as 
permanent or temporary function where as it is registered as temporary function 
in step 4 that is why in step 9 select is returning result.




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to