Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18142
  
    
    
    I am leaving a note (at least to myself) since it looked anyhow caused 
behaviour change.
    
    
    With this statements in Hive side:
    
    ```sql
    CREATE TABLE emp AS SELECT 'user' AS name, 'address' as address;
    CREATE DATABASE d100;
    CREATE FUNCTION d100.udf100 AS 
'org.apache.hadoop.hive.ql.udf.generic.GenericUDFUpper';
    ```
    
    
    **Hive**
    
    
    ```
    hive> SELECT d100.udf100(`emp`.`name`) FROM `emp`;
    USER
    hive> SELECT `d100.udf100`(`emp`.`name`) FROM `emp`;
    USER
    ```
    
    
    **Spark**
    
    Before:
    
    ```
    scala> spark.sql("SELECT d100.udf100(`emp`.`name`) FROM `emp`").show
    +-----------------+
    |d100.udf100(name)|
    +-----------------+
    |             USER|
    +-----------------+
    
    
    scala> spark.sql("SELECT `d100.udf100`(`emp`.`name`) FROM `emp`").show
    +-----------------+
    |d100.udf100(name)|
    +-----------------+
    |             USER|
    +-----------------+
    ```
    
    After:
    
    ```
    scala> spark.sql("SELECT d100.udf100(`emp`.`name`) FROM `emp`").show
    +-----------------+
    |d100.udf100(name)|
    +-----------------+
    |             USER|
    +-----------------+
    
    
    scala> spark.sql("SELECT `d100.udf100`(`emp`.`name`) FROM `emp`").show
    org.apache.spark.sql.AnalysisException: Undefined function: 'd100.udf100'. 
This function is neither a registered temporary function nor a permanent 
function registered in the database 'default'.; line 1 pos 7
    ```
    
    
    **MySQL**
    
    This change causes a inconsistency with Hive although looks consistent 
compating to MySQL.
    
    ```
    mysql> SELECT `d100.udf100`(`emp`.`name`) FROM `emp`;
    ERROR 1305 (42000): FUNCTION hkwon.d100.udf100 does not exist
    mysql> SELECT d100.udf100(`emp`.`name`) FROM `emp`;
    +---------------------------+
    | d100.udf100(`emp`.`name`) |
    +---------------------------+
    | Hello, user!              |
    +---------------------------+
    1 row in set (0.01 sec)
    ```



---

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

Reply via email to