diff --git accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/predicate/AccumuloRangeGenerator.java accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/predicate/AccumuloRangeGenerator.java index d794e94..21392d1 100644 --- accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/predicate/AccumuloRangeGenerator.java +++ accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/predicate/AccumuloRangeGenerator.java @@ -42,6 +42,7 @@ import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; import org.apache.hadoop.hive.serde2.lazy.LazyUtils; import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantBooleanObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantByteObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantDoubleObjectInspector; @@ -57,7 +58,7 @@ * */ public class AccumuloRangeGenerator implements NodeProcessor { - private static final Logger log = LoggerFactory.getLogger(AccumuloRangeGenerator.class); + private static final Logger LOG = LoggerFactory.getLogger(AccumuloRangeGenerator.class); private final AccumuloPredicateHandler predicateHandler; private final HiveAccumuloRowIdColumnMapping rowIdMapping; @@ -162,7 +163,7 @@ protected Object processAndOpNode(Node nd, Object[] nodeOutputs) { andRanges = newRanges; } } else { - log.error("Expected Range from {} but got {}", nd, nodeOutput); + LOG.error("Expected Range from {} but got {}", nd, nodeOutput); throw new IllegalArgumentException("Expected Range but got " + nodeOutput.getClass().getName()); } @@ -181,7 +182,7 @@ protected Object processOrOpNode(Node nd, Object[] nodeOutputs) { List childRanges = (List) nodeOutput; orRanges.addAll(childRanges); } else { - log.error("Expected Range from " + nd + " but got " + nodeOutput); + LOG.error("Expected Range from {} but got {}", nd, nodeOutput); throw new IllegalArgumentException("Expected Range but got " + nodeOutput.getClass().getName()); } @@ -324,27 +325,9 @@ protected Text getUtf8Value(ConstantObjectInspector objInspector) { */ protected Text getBinaryValue(ConstantObjectInspector objInspector) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); - if (objInspector instanceof WritableConstantBooleanObjectInspector) { + if (objInspector instanceof PrimitiveObjectInspector) { LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantBooleanObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantByteObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantByteObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantShortObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantShortObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantIntObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantIntObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantLongObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantLongObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantDoubleObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantDoubleObjectInspector) objInspector); - } else if (objInspector instanceof WritableConstantFloatObjectInspector) { - LazyUtils.writePrimitive(out, objInspector.getWritableConstantValue(), - (WritableConstantDoubleObjectInspector) objInspector); + (PrimitiveObjectInspector) objInspector); } else { return getUtf8Value(objInspector); }