You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by lxw <lx...@qq.com> on 2013/06/14 11:51:00 UTC

How to convert Array to String in Hive0.7

Hi, all :

    How to convert Array to String in Hive0.7?

    concat_ws(string SEP, array<string>)   Like concat_ws() above, but taking an array of strings. (as of Hive 0.9.0) 
    
    this function was not supported,who can help me?


thanks!

Re: How to convert Array to String in Hive0.7

Posted by Stephen Sprague <sp...@gmail.com>.
remember too the transform() function for rolling your own, well,
transformations.


On Fri, Jun 14, 2013 at 3:07 AM, Jan DolinĂ¡r <do...@gmail.com> wrote:

> Hi,
>
> I was facing the same problem few weeks ago. The final solution was quick
> and dirty - I grabbed the code for this UDF from
> http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFConcatWS.java?revision=1234150&view=markup&pathrev=1234150and compiled it the same way as my other UDFs.
>
> The only part that doesn't work with hive 0.7 is the argument type
> checking in initialize() method because of serdeConstants were not
> available in this version. The dirty part of the solution is that I just
> commented out all but last two lines of this method and the serdeConstants
> import :-) As long as you don't pass wrong arguments to it, it works fine,
> otherwise you get an error at runtime, while proper code should refuse to
> even compile the query.
>
>
>
> On Fri, Jun 14, 2013 at 11:51 AM, lxw <lx...@qq.com> wrote:
>
>> Hi, all :
>>
>>     How to convert Array to String in Hive0.7?
>>
>>     concat_ws(string SEP, array<string>) Like concat_ws() above, but
>> taking an array of strings. (as of Hive 0.9.0<https://issues.apache.org/jira/browse/HIVE-2203>)
>>
>>
>>     this function was not supported,who can help me?
>>
>>
>> thanks!
>>
>>
>>
>>
>>
>>
>>
>
>

Re: How to convert Array to String in Hive0.7

Posted by Jan DolinĂ¡r <do...@gmail.com>.
Hi,

I was facing the same problem few weeks ago. The final solution was quick
and dirty - I grabbed the code for this UDF from
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFConcatWS.java?revision=1234150&view=markup&pathrev=1234150and
compiled it the same way as my other UDFs.

The only part that doesn't work with hive 0.7 is the argument type checking
in initialize() method because of serdeConstants were not available in this
version. The dirty part of the solution is that I just commented out all
but last two lines of this method and the serdeConstants import :-) As long
as you don't pass wrong arguments to it, it works fine, otherwise you get
an error at runtime, while proper code should refuse to even compile the
query.



On Fri, Jun 14, 2013 at 11:51 AM, lxw <lx...@qq.com> wrote:

> Hi, all :
>
>     How to convert Array to String in Hive0.7?
>
>     concat_ws(string SEP, array<string>) Like concat_ws() above, but
> taking an array of strings. (as of Hive 0.9.0<https://issues.apache.org/jira/browse/HIVE-2203>)
>
>
>     this function was not supported,who can help me?
>
>
> thanks!
>
>
>
>
>
>
>