[ 
https://issues.apache.org/jira/browse/SPARK-5117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cheng Hao resolved SPARK-5117.
------------------------------
    Resolution: Won't Fix

This IS NOT a bug of Spark SQL.

Hive changed the LPAD implementation since Hive 0.13, previously(Hive 0.12) the 
LPAD was implemented as the UDF, and the UDF Bridge will cast the un-match 
argument type when necessary. However, in Hive 0.13, LPAD was re-implemented as 
Generic UDF, which means the function itself has to take care of the arguments 
type, and will throws exception if un-matched argument type found.

I've also test that in Hive 0.13, it says:
{panel}
hive> SELECT LPAD("test",5, 0) FROM src LIMIT 1;                                
                        
FAILED: ClassCastException org.apache.hadoop.io.IntWritable cannot be cast to 
org.apache.hadoop.io.Text
hive> 
{panel}

>From the document of Hive:
{panel}
lpad(string str, int len, string pad)
{panel}
The third parameter should be String-based type, the end-user should take care 
of the new usage for this function.

> Hive Generic UDFs don't cast correctly
> --------------------------------------
>
>                 Key: SPARK-5117
>                 URL: https://issues.apache.org/jira/browse/SPARK-5117
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.2.0
>            Reporter: Michael Armbrust
>            Assignee: Cheng Hao
>            Priority: Blocker
>
> Here's a test cast that is failing in master:
> {code}
>   createQueryTest("generic udf casting",
>     """SELECT LPAD("test",5, 0) FROM src LIMIT 1""")
> {code}
> This appears to be a regression from Spark 1.1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to