You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zheng Shao (JIRA)" <ji...@apache.org> on 2010/02/18 20:20:27 UTC

[jira] Created: (HIVE-1179) Add UDF array_contains

Add UDF array_contains
----------------------

                 Key: HIVE-1179
                 URL: https://issues.apache.org/jira/browse/HIVE-1179
             Project: Hadoop Hive
          Issue Type: New Feature
            Reporter: Zheng Shao


Returns true or false, depending on whether an element is in an array.
{{array_contains(T element, array<T> theArray)}}


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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Attachment: HIVE-1179-3.patch

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Paul Yang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870793#action_12870793 ] 

Paul Yang commented on HIVE-1179:
---------------------------------

I'm not quite sure if I follow, as this is not an aggregation function. Can you give an example of a query that would trigger the error if we made it a member variable?

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Paul Yang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870955#action_12870955 ] 

Paul Yang commented on HIVE-1179:
---------------------------------

It should be okay as several other UDF's have a member 'result' variable to reduce object creation - see UDFAbs for example. Since UDFAbs outputs a double, could you use it to demonstrate the potential issue?


> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Paul Yang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870265#action_12870265 ] 

Paul Yang commented on HIVE-1179:
---------------------------------

One minor point - can you make result a member variable of GenericUDFArrayContains? This will reduce object creation.

The patch needs to be regenerated against the current trunk, but otherwise looks good.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Attachment: HIVE-1179.patch

*Summary:*
This patch implements the array_contains UDF. The signature of this UDF is array_contains(array, value). It returns true if value exists within the array. The comparison of value with array elements is done using the ObjectInspectorUtils' compare method.

*Special Case:* 
The implementation of ObjectInspectorUtils.compare() method currently does not handle map comparisons and raises a runtime exception when it encounters a map type. To avoid this exception, a call to compareSupported() method is made by the UDF during initialization. If this method returns false, a UDFArgumentException is raised stating that the argument type does not support comparison.

*Implementation Details:*
_GenericUDFArrayContains.java_
	- added to {{org.apache.hadoop.hive.ql.udf.generic}} package
	- its initialize method does the following (a) checks to see if there are exactly two arguments specified, (b) if the first argument is of a LIST type, (c) if the type of list element and the type of value argument is identical, and (d) if comparison for such types is supported.
	- its evaluate method calls into {{ObjectInspectorUtils.compare()}} method to test if the given value matches any of the elements of the given array.
	  
_ObjectInspectorUtils:_
	- added a new method called {{compareTypes(ObjectInspector, ObjectInspector)}} which returns true if the two types represented are identical. This  comparison is done via recursive call to elements of the type until all elements are deemed identical down to their primitive constituents.

_FunctionRegistry:_
	- Registered the {{GenericUDFArrayContains}} as array_contains
	- Some whitespace formatting changes and removal of redundant casts
	
_package-info.java_
	- added the missing file to hive.ql.generic package.
	
_Test cases:_
	- client positive test: {{udf_array_contains.q}}
	- client negative tests: {{udf_array_contains_wrong1.q}}, {{udf_array_contains_wrong2.q}}
	
	

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Paul Yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Yang updated HIVE-1179:
----------------------------

    Status: Open  (was: Patch Available)

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Attachment: HIVE-1179-1.patch

*Summary:*
The previously submitted patch had changes that removed seemingly redundant casts needed by Hadoop 0.17.x. This change reverts the casts and also fixes what caused the removal of the casts.

*Details:*
Due to the default JDT preferences set for Eclipse, the _Clean Up_ code formatter automatically removes any redundant casts in the file being saved. This caused the casts to be removed from {{FunctionRegistry.java}} for return value of calls to {{ReflectionUtils.newInstance()}} method. 

The cast of this return value was deemed redundant because the newer version of {{ReflectionUtils.newInstance()}}  returns a typed object of the expected type in call context. However, the previous version of {{ReflectionUtils.newInstance()}} returned only {{java.lang.Object}} instead. This caused the change to not compile against previous version of {{ReflectionUtils}}.

*Changes from last patch:*

1. The {{FunctionRegistry.java}} file has been edited to restore the previously removed casts.

2. The default preferences for Eclipse JDT UI that controls the _Clean Up_ code formatter that cased this problem has been updated to not remove redundant casts from the file being saved.

*Testing done:*
-  Compiled and tested the change against the default version of Hadoop.
-  Compiled and tested against 0.17.2.1 version as well.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Namit Jain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879149#action_12879149 ] 

Namit Jain commented on HIVE-1179:
----------------------------------

The patch applies cleanly - will commit if the tests pass

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12840869#action_12840869 ] 

Carl Steinbach commented on HIVE-1179:
--------------------------------------

+1 Patch looks good.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Attachment: HIVE-1179-2.patch

Updated the patch to work with current trunk.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Assigned: (HIVE-1179) Add UDF array_contains

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao reassigned HIVE-1179:
--------------------------------

    Assignee: Arvind Prabhakar

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao updated HIVE-1179:
-----------------------------

    Status: Open  (was: Patch Available)

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843270#action_12843270 ] 

Arvind Prabhakar commented on HIVE-1179:
----------------------------------------

Thanks for pointing that out Zheng. I will update and resubmit the patch soon.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842237#action_12842237 ] 

Zheng Shao commented on HIVE-1179:
----------------------------------

Hi Arvind, we have to restore the "unnecessary" type conversion for hadoop 0.17.
Try the following command and you will see why:

{code}
ant -Dhadoop.version=0.17.2.1 clean package
{code}


> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Paul Yang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871380#action_12871380 ] 

Paul Yang commented on HIVE-1179:
---------------------------------

Yeah, I see your concern, but we're using mutable objects for performance reasons in this case and I believe there is an assumption that you shouldn't keep references to objects passed through the operator DAG (in general).

+1

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871331#action_12871331 ] 

Arvind Prabhakar commented on HIVE-1179:
----------------------------------------

I took a quick look at the various Operator implementations and found that the ones that store any evaluated expression results end up creating copies anyway - {{ObjectInspectorUtils.copyToStandardObject()}}. So although it appears that the system is working normally by reusing the object instance at the UDF level, code elsewhere in the system is forced to do the defensive copying. 

To clarify, my concern is not regarding a problem that may currently exist - but the potential problems that could occur due to not making defensive copies of mutable objects. If you are certain that this is does not apply to Hive implementation, then the updated patch should be fine for pushing in.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Namit Jain (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Namit Jain updated HIVE-1179:
-----------------------------

          Status: Resolved  (was: Patch Available)
    Hadoop Flags: [Reviewed]
      Resolution: Fixed

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>             Fix For: 0.6.0
>
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Status: Patch Available  (was: Open)

Paul - I have updated the patch. I do not have any examples of queries that will produce this failure today as no UDAF that can be applied to boolean input today does batch processing. My concern was primarily for creating defensive objects to guard against inadvertent mutation. 

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179-3.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Status: Patch Available  (was: Open)

Please see comments associated with the HIVE-1179.patch attachment.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>         Attachments: HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Updated: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated HIVE-1179:
-----------------------------------

    Status: Patch Available  (was: Open)

Please see the comment associated with the updated patch file.

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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


[jira] Commented: (HIVE-1179) Add UDF array_contains

Posted by "Arvind Prabhakar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870475#action_12870475 ] 

Arvind Prabhakar commented on HIVE-1179:
----------------------------------------

bq. One minor point - can you make result a member variable of GenericUDFArrayContains? This will reduce object creation.

While this will reduce object creation, it will cause correctness problems when this UDF is used in an aggregate operation. Using a member variable for {{result}} would then mean that all values of aggregated output will always reflect the evaluated value of the last row. A similar problem would occur if there is a lag between collecting and processing of output values. Hence my preference is to keep the implementation as is (stateless).

If you still would like to make it a member variable, please let me know and I can make that change. 

> Add UDF array_contains
> ----------------------
>
>                 Key: HIVE-1179
>                 URL: https://issues.apache.org/jira/browse/HIVE-1179
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Arvind Prabhakar
>         Attachments: HIVE-1179-1.patch, HIVE-1179-2.patch, HIVE-1179.patch
>
>
> Returns true or false, depending on whether an element is in an array.
> {{array_contains(T element, array<T> theArray)}}

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