-Re: Accessing elements from array returned by split() function
Philip Tromans 2012-03-01, 21:22
I guess that split(...) is giving you what's inbetween the 1st and
2nd '/' character, which is nothing. Try split(...).
On 1 March 2012 21:19, Saurabh S <[EMAIL PROTECTED]> wrote:
> I have a set of URLs which I need to parse. For example, if the url is,
> I need to extract www.google.com, i.e. everything between second and third
> forward slashes.
> I can't figure out the regex pattern to do so, and am trying to use split()
> function instead. So, my hive query looks like
> select url, split(url,'/')
> The second column contains the entire array returned by the split function.
> Is there any way to access only the second element of the array, which will
> give me what I need?
> When I try the following statement select url, split(url,'/'), I get an
> empty second column.
> Is this the expected behavior? Any other suggestions on how to parse the
> Oh by the way, I'm aware that the function parse_url(url,'HOST') will give
> me something similar to what I want, but for some reason, that function on
> my database is running extremely slow.
> First time posting to this list. If there is anything wrong, please let me