Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcongiu committed Jul 10, 2014
1 parent bc10f2a commit dff393a
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,30 @@

package org.openx.data.jsonserde.objectinspector.primitive;

import org.apache.hadoop.hive.serde2.objectinspector.primitive.AbstractPrimitiveJavaObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableByteObjectInspector;
import org.apache.hadoop.io.ByteWritable;

/**
*
* @author rcongiu
*/
public class JavaStringByteObjectInspector
public class JavaStringByteObjectInspector extends AbstractPrimitiveJavaObjectInspector
implements SettableByteObjectInspector {


public JavaStringByteObjectInspector() {
super(PrimitiveObjectInspectorUtils.byteTypeEntry);
}

@Override
public Object getPrimitiveWritableObject(Object o) {
if(o == null) return null;

if(o instanceof String) {
return new ByteWritable(ParsePrimitiveUtils.parseByte((String)o));
} else {
return new ByteWritable(((Byte) o).byteValue());
return new ByteWritable((Byte) o);
}
}

Expand All @@ -39,58 +44,29 @@ public byte get(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseByte((String)o);
} else {
return ((Byte) o).byteValue();
return ((Byte) o);
}
}

@Override
public Object create(byte value) {
return Byte.valueOf(value);
return (value);
}

@Override
public Object set(Object o, byte value) {
return Byte.valueOf(value);
if(o instanceof ByteWritable) {
((ByteWritable)o).set(value);
} else {
throw new RuntimeException("Can't set a " + o.getClass().getName());
}
return value;
}

@Override
public PrimitiveCategory getPrimitiveCategory() {
return PrimitiveCategory.BYTE;
}

@Override
public Class<?> getPrimitiveWritableClass() {
return ByteWritable.class;
}

@Override
public Class<?> getJavaPrimitiveClass() {

}

@Override
public Object getPrimitiveJavaObject(Object o) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public Object copyObject(Object o) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public boolean preferWritable() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public String getTypeName() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public Category getCategory() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Object getPrimitiveWritableObject(Object o) {
if(o instanceof String) {
return new DoubleWritable(Double.parseDouble((String)o));
} else {
return new DoubleWritable(((Double) o).doubleValue());
return new DoubleWritable(((Double) o));
}
}

Expand All @@ -45,18 +45,22 @@ public double get(Object o) {
if(o instanceof String) {
return Double.parseDouble((String)o);
} else {
return (((Double) o).doubleValue());
return (((Double) o));
}
}

@Override
public Object create(double value) {
return Double.valueOf(value);
return value;
}

@Override
public Object set(Object o, double value) {
return Double.valueOf(value);
if(o instanceof DoubleWritable) {
return value;
} else {
throw new RuntimeException("Can't set a " + o.getClass().getName());
}
}

}
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 0 additions & 5 deletions json-serde-cdh4-shim/target/maven-archiver/pom.properties

This file was deleted.

Empty file.

0 comments on commit dff393a

Please sign in to comment.