You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Edward Capriolo <ed...@gmail.com> on 2009/10/14 00:19:24 UTC

Trying to understand WritableStringObjectInspector

As part of HIVE-867 I was working on an aes_encrpt and and aes_decrypt
function similar to what mysql provides.

http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html#function_aes-encrypt

I tried several iterations of having aes_encrypt udf return
String,text, etc. But the data always seemed to get converted/mangled
somehow.

In aes_decrypt :
 data_string =  ((WritableStringObjectInspector)argumentOIs[0])
.getPrimitiveJavaObject(arguments[0].get()) ;

Would not return the value properly. I had to use.
 Text t = (org.apache.hadoop.io.Text) arguments[0].get();

Should the conversions from text -> string -> text preserve all data?

Or with binary data is it only correct to do t.set(byte []) and t.getBytes() ?

Anyway, I have it working now but would really like to understand what
I was doing wrong, or if this is some type of bug. Please look at my
latest HIVE-867 if you have some time!

Hive FTW!