You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ping Zhu <pi...@sharethis.com> on 2010/07/20 21:03:39 UTC
built-in UTF8 checker
Hi,
Are there are any built-in functions in Hive to check whether a string is
UTF8-encoding? I did some research about this issue but did not find useful
resources. Thanks for your suggestions and help.
Ping
Re: built-in UTF8 checker
Posted by Ping Zhu <pi...@sharethis.com>.
Please ignore my previous email. I was forwarding Zheng's email to my
friend. Sorry for inconvenience caused.
Best,
Ping
On Wed, Jul 21, 2010 at 9:02 AM, Ping Zhu <pi...@sharethis.com> wrote:
> There are built-in Hadoop UTF8 checker.
>
>
> ---------- Forwarded message ----------
> From: Zheng Shao <zs...@gmail.com>
> Date: Tue, Jul 20, 2010 at 11:40 PM
> Subject: Re: built-in UTF8 checker
> To: hive-user@hadoop.apache.org
>
>
> No, but it's very simple to write one.
>
> public class MyUTF8StringChecker extends UDF {
> public boolean evaluate(Text t) {
> try {
> Text.validateUTF8(t.getBytes(), 0, t.getLength());
> return true;
> } catch (MalformedInputException e) {
> return false;
> }
> }
> }
>
>
> On Tue, Jul 20, 2010 at 12:03 PM, Ping Zhu <pi...@sharethis.com> wrote:
> > Hi,
> > Are there are any built-in functions in Hive to check whether a string
> is
> > UTF8-encoding? I did some research about this issue but did not find
> useful
> > resources. Thanks for your suggestions and help.
> > Ping
>
>
>
> --
> Yours,
> Zheng
> http://www.linkedin.com/in/zshao
>
>
Re: built-in UTF8 checker
Posted by Ping Zhu <pi...@sharethis.com>.
There are built-in Hadoop UTF8 checker.
---------- Forwarded message ----------
From: Zheng Shao <zs...@gmail.com>
Date: Tue, Jul 20, 2010 at 11:40 PM
Subject: Re: built-in UTF8 checker
To: hive-user@hadoop.apache.org
No, but it's very simple to write one.
public class MyUTF8StringChecker extends UDF {
public boolean evaluate(Text t) {
try {
Text.validateUTF8(t.getBytes(), 0, t.getLength());
return true;
} catch (MalformedInputException e) {
return false;
}
}
}
On Tue, Jul 20, 2010 at 12:03 PM, Ping Zhu <pi...@sharethis.com> wrote:
> Hi,
> Are there are any built-in functions in Hive to check whether a string
is
> UTF8-encoding? I did some research about this issue but did not find
useful
> resources. Thanks for your suggestions and help.
> Ping
--
Yours,
Zheng
http://www.linkedin.com/in/zshao
Re: built-in UTF8 checker
Posted by Ping Zhu <pi...@sharethis.com>.
Thanks, Zheng.
On Tue, Jul 20, 2010 at 11:40 PM, Zheng Shao <zs...@gmail.com> wrote:
> No, but it's very simple to write one.
>
> public class MyUTF8StringChecker extends UDF {
> public boolean evaluate(Text t) {
> try {
> Text.validateUTF8(t.getBytes(), 0, t.getLength());
> return true;
> } catch (MalformedInputException e) {
> return false;
> }
> }
> }
>
>
> On Tue, Jul 20, 2010 at 12:03 PM, Ping Zhu <pi...@sharethis.com> wrote:
> > Hi,
> > Are there are any built-in functions in Hive to check whether a string
> is
> > UTF8-encoding? I did some research about this issue but did not find
> useful
> > resources. Thanks for your suggestions and help.
> > Ping
>
>
>
> --
> Yours,
> Zheng
> http://www.linkedin.com/in/zshao
>
Re: built-in UTF8 checker
Posted by Zheng Shao <zs...@gmail.com>.
No, but it's very simple to write one.
public class MyUTF8StringChecker extends UDF {
public boolean evaluate(Text t) {
try {
Text.validateUTF8(t.getBytes(), 0, t.getLength());
return true;
} catch (MalformedInputException e) {
return false;
}
}
}
On Tue, Jul 20, 2010 at 12:03 PM, Ping Zhu <pi...@sharethis.com> wrote:
> Hi,
> Are there are any built-in functions in Hive to check whether a string is
> UTF8-encoding? I did some research about this issue but did not find useful
> resources. Thanks for your suggestions and help.
> Ping
--
Yours,
Zheng
http://www.linkedin.com/in/zshao