There are built-in Hadoop UTF8 checker.

---------- Forwarded message ----------
From: Zheng Shao <[email protected]>
Date: Tue, Jul 20, 2010 at 11:40 PM
Subject: Re: built-in UTF8 checker
To: [email protected]


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 <[email protected]> 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

Reply via email to