[ 
https://issues.apache.org/jira/browse/HIVE-521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714937#action_12714937
 ] 

Zheng Shao commented on HIVE-521:
---------------------------------

Nice work.

Several issues:
1. It seems the code does not work if the boolean expression evaluates to null. 
Can you add a test case (like ql/test/query/clientpositive/udf*.q) and run "ant 
test -Dtestcase=TestCliDriver -Dqfile=udf_if.q -Doverwrite=true) to generate 
the standard output of the query? Also we need to do "svn add" for both the 
query file and the result file.
2. GenericUDFIsNull and GenericUDFIsNotNull can be very simple - just test if 
the Object is null or not in evaluate. We are now doing it in UDFIsNull etc but 
we did add special handling code to make sure we can pass a complex object into 
UDF. That solution is half-baked (can only test whether it's null/not null but 
there is no way to inspect the internal structure because no ObjectInspector is 
passed) and very ugly. That's why we want to move it to GenericUDF.
3. The above argument is also true for size(). We have special handling code in 
UDF to make sure we can convert a Hive map/list data structure to java 
map/list, which is also half-baked and hacky.

Let me know if you have any questions on this.

> Move size, if, isnull, isnotnull to GenericUDF
> ----------------------------------------------
>
>                 Key: HIVE-521
>                 URL: https://issues.apache.org/jira/browse/HIVE-521
>             Project: Hadoop Hive
>          Issue Type: Improvement
>    Affects Versions: 0.4.0
>            Reporter: Zheng Shao
>            Assignee: Min Zhou
>             Fix For: 0.4.0
>
>         Attachments: HIVE-521-IF-2.patch, HIVE-521-IF.patch
>
>
> See HIVE-511 for an example of the move.
> size, if, isnull, isnotnull are all implemented with UDF but they are 
> actually working on variable types of objects. We should move them to 
> GenericUDF for better type handling.
> This also helps to clean up the hack in doing type matching/type conversion 
> in UDF.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to