You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Tucker, Matt" <Ma...@disney.com> on 2012/05/11 17:46:58 UTC

Hex and UnHex UDFs

I'm trying to convert a base-16 string to a base-10 bigint, but I'm getting strange results using unhex().

When I convert 2819892256088064694 with hex(), I get "27224511050102B6".  Converting it back using unhex(), I get strange output ('"E).  Casting the output to bigint does not resolve the issue.

For comparison, java.math.BigInteger("27224511050102B6", 16) returns the correct base-10 value.

Is there a way to use the reflect() UDF with the BigInteger constructor? Is this unhex() output considered correct?

Thanks

Matt