Guys!!!!!!!!! Please Reply On Tue, Jan 31, 2017 at 12:31 PM, Alex <siri8...@gmail.com> wrote:
> public Object get(Object name) { > int pos = getPos((String) name); > if (pos < 0) > return null; > String f = "string"; > Object obj = list.get(pos); > Object result = null; > if (obj == null) > return null; > ObjectInspector ins = ((StructField) colnames.get(pos)). > getFieldObjectInspector(); > if (ins != null) > f = ins.getTypeName(); > > PrimitiveObjectInspector ins2 = > (PrimitiveObjectInspector) ins; > switch (ins2.getPrimitiveCategory()) { > case DOUBLE: > > Double res = (Double)(((DoubleObjectInspector) > ins2).get(obj)); > result = (double) res; > return result; > > > case LONG: > > Long res1 = (Long)(((LongObjectInspector) > ins2).get(obj)); > result = (long) res1; > return result; > > > case STRING: > result = (((StringObjectInspector) > ins2).getPrimitiveJavaObject(obj)).toString(); > return result; > > default: > result = obj; > return result; > } > > } > > > > > Code 2 ) > > > public Object get(Object name) { > int pos = getPos((String)name); > if(pos<0) return null; > String f = "string"; > Object obj= list.get(pos); > if(obj==null) return null; > ObjectInspector ins = ((StructField)colnames.get( > pos)).getFieldObjectInspector(); > if(ins!=null) f = ins.getTypeName(); > switch (f) { > case "double" : return ((DoubleWritable)obj).get(); > case "bigint" : return ((LongWritable)obj).get(); > case "string" : return ((Text)obj).toString(); > default : return obj; > } > } > > > But getting different results in hive and spark >