Hiiii, Please Reply?
On Fri, Feb 3, 2017 at 8:19 PM, Alex <siri8...@gmail.com> wrote: > Hi, > > can You guys tell me if below peice of two codes are returning the same > thing? > > (((DoubleObjectInspector) ins2).get(obj)); and (DoubleWritable)obj).get() > ; from below two codes > > > code 1) > > 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; > } > } > > > Code 2) > > public Object get(Object name) { > > int pos = getPos((String) name); > > if (pos < 0) > > return null; > > String f = "string"; > > String f1 = "string"; > > Object obj = list.get(pos); > > > > if (obj == null) > > return null; > > ObjectInspector ins = ((StructField) > colnames.get(pos)).getFieldObjectInspector(); > > if (ins != null) > > f = ins.getTypeName(); > > > > > > PrimitiveObjectInspector ins2 = > (PrimitiveObjectInspector) ins; > > f1 = ins2.getPrimitiveCategory().name(); > > > > > > switch (ins2.getPrimitiveCategory()) { > > case DOUBLE: > > > > return (((DoubleObjectInspector) ins2).get(obj)); > > > > case LONG: > > > > return (((LongObjectInspector) ins2).get(obj)); > > > > case STRING: > > return (((StringObjectInspector) > ins2).getPrimitiveJavaObject(obj)).toString(); > > > > default: return obj; > > } > > } >