You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Mohammad Tariq <do...@gmail.com> on 2013/06/10 23:59:25 UTC
parse_url returning NULL
Hello list,
I have a file stored in my HDFS which contains some urls. File
looks like this :
abc.in
xyz.net
http://tariq.com
http://tariq.in/sompath
And i'm trying to get the hostnames from these urls using *parse_url*. It
works fine except for the urls which do not contain any scheme. So when I
issue
hive> select parse_url(url, 'HOST') from url;
it gives me :
NULL
NULL
tariq.com
tariq.in
Could someone please point out the mistake? Many thanks.
Warm Regards,
Tariq
cloudfront.blogspot.com
Re: parse_url returning NULL
Posted by Mohammad Tariq <do...@gmail.com>.
Hello Edward,
Thank you so much for the quick response. I'll try it out. But I
would like to know, is it something Hive specific?Links do work without a
scheme, like *hive.apache.org*.
Thank again.
Warm Regards,
Tariq
cloudfront.blogspot.com
On Tue, Jun 11, 2013 at 3:40 AM, Edward Capriolo <ed...@gmail.com>wrote:
> It is not a valid URL if it does not have a scheme and can not be parsed.
>
> SELECT if (column like 'http%', column, concat( 'http://', column) ) as
> column might do what you need.
>
>
> On Mon, Jun 10, 2013 at 5:59 PM, Mohammad Tariq <do...@gmail.com>wrote:
>
>> Hello list,
>>
>> I have a file stored in my HDFS which contains some urls. File
>> looks like this :
>> abc.in
>> xyz.net
>> http://tariq.com
>> http://tariq.in/sompath
>>
>> And i'm trying to get the hostnames from these urls using *parse_url*.
>> It works fine except for the urls which do not contain any scheme. So when
>> I issue
>>
>> hive> select parse_url(url, 'HOST') from url;
>>
>> it gives me :
>>
>> NULL
>> NULL
>> tariq.com
>> tariq.in
>>
>> Could someone please point out the mistake? Many thanks.
>>
>> Warm Regards,
>> Tariq
>> cloudfront.blogspot.com
>>
>
>
Re: parse_url returning NULL
Posted by Edward Capriolo <ed...@gmail.com>.
It is not a valid URL if it does not have a scheme and can not be parsed.
SELECT if (column like 'http%', column, concat( 'http://', column) ) as
column might do what you need.
On Mon, Jun 10, 2013 at 5:59 PM, Mohammad Tariq <do...@gmail.com> wrote:
> Hello list,
>
> I have a file stored in my HDFS which contains some urls. File
> looks like this :
> abc.in
> xyz.net
> http://tariq.com
> http://tariq.in/sompath
>
> And i'm trying to get the hostnames from these urls using *parse_url*. It
> works fine except for the urls which do not contain any scheme. So when I
> issue
>
> hive> select parse_url(url, 'HOST') from url;
>
> it gives me :
>
> NULL
> NULL
> tariq.com
> tariq.in
>
> Could someone please point out the mistake? Many thanks.
>
> Warm Regards,
> Tariq
> cloudfront.blogspot.com
>