sandeep-katta opened a new pull request #25452: [SPARK-28710][SQL]to fix 
replace function, spark should call drop and create function
URL: https://github.com/apache/spark/pull/25452
 
 
   ## What changes were proposed in this pull request?
   
   create or replace function **X as 'Y' using jar Z**;  does not work if the X 
is already present and is created with some other jar lets say xyz.
   
   As per current implementation spark calls alter Function API of Hive, as of 
now Hive only alter name, owner, class name, type but not resource URI. After 
calling alter function only  **X and Y**  are updated **but not Z.**
   
   So when the select is performed on X UDF it throws class not found exception.
   
   Observation 1: Temporary function does not have this problem as it is 
handled by spark logic 
   
   Observation 2: For permanent function Spark calls the Hive to alter function 
, as of now Hive only alter name, owner, class name, type but not resource URI.
   
   
[SparkCode](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/command/functions.scala#L86)
   
   [Hive 
Code](https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L9914)
   
    As per [Hive 
Documentation](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Create/Drop/ReloadFunction)
 it does not supports create or replace command for function
   
   ## How was this patch tested?
   
   Added UT and also manually tested
   
   Before Fix:
   
![image](https://user-images.githubusercontent.com/35216143/63011564-308e6e00-bea6-11e9-8b1d-271847a96018.png)
   
   After Fix:
   
![image](https://user-images.githubusercontent.com/35216143/63011970-fa9db980-bea6-11e9-8d7f-1aece951ca84.png)
   
   
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to