hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Burgess <>
Subject Unions of Maps
Date Mon, 08 Aug 2016 23:39:31 GMT
Hello all,

I'm using Hive 1.2.1, and let's say I have the following type info
(code simplified):

typeInfo = TypeInfoUtils.getTypeInfoFromTypeString("uniontype<map<string,float>,map<string,int>>")

I can get the appropriate ObjectInspectors:

oi = TypeInfoUtils.getStandardWritableObjectInspectorFromTypeInfo(typeInfo)

map1oi = oi.getObjectInspectors().get(0)

map2oi = oi.getObjectInspectors().get(1)

I'm trying to fill a map (actually a MapWritable, I'm converting these
to ORC).  Now let's say I'm given a Map object. How would I
programmatically tell which one of the union "entries" is the right
one to use? Do I just try the put() command and if it fails, try the
next ObjectInspector? Do I try to get the Class of the key/value and
recursively try to build an "output object" that way? Or am I missing
a better way to resolve the correct union type against the incoming

Thank you in advance,

View raw message