Skip to content
23 changes: 20 additions & 3 deletions docs/sql-ref-syntax-ddl-drop-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ SHOW USER FUNCTIONS;
| default.test_avg |
+-------------------+

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: delete this line ?

-- Create Temporary function `temp_avg`
CREATE TEMPORARY FUNCTION temp_avg as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: delete this line ?

-- List user functions
SHOW USER FUNCTIONS;
+-------------------+
| function |
+-------------------+
| default.test_avg |
| temp_avg |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the functions having the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, one with permanent and other with Temporary

Copy link
Contributor

@dilipbiswal dilipbiswal Sep 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gatorsmile The permanent functions are always shown as database qualified where as the temporary functions are not qualified. Oh.. oops :-) one is test_avg and the other is temp_avg.. . @sandeep-katta can you check, please ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops :), sorry I corrected it

image

+-------------------+

-- Drop Permanent function
DROP FUNCTION test_avg;
+---------+
Expand All @@ -72,9 +84,14 @@ DROP FUNCTION test_avg;
org.apache.spark.sql.catalyst.analysis.NoSuchPermanentFunctionException:
Function 'default.test_avg' not found in database 'default'; (state=,code=0)

-- Create Temporary function `temp_avg`
CREATE TEMPORARY FUNCTION temp_avg as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage';

-- List the functions after dropping, it should list only temporary function
SHOW USER FUNCTIONS;
+-----------+
| function |
+-----------+
| temp_avg |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandeep-katta Why is it temp_avg here ? Shouldn't it be temporary function test_avg ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @sandeep-katta to fix that part

+-----------+

-- Drop Temporary function
DROP TEMPORARY FUNCTION IF EXISTS temp_avg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandeep-katta same question :-)

+---------+
Expand Down