static byte[] getConstantVal(Object writable, PrimitiveObjectInspector poi, boolean isKeyBinary)
      throws IOException {

    if (!isKeyBinary) {
      // Key is stored in text format. Get bytes representation of constant also of
      // text format.
      byte[] startRow;
      ByteStream.Output serializeStream = new ByteStream.Output();
      LazyUtils.writePrimitiveUTF8(serializeStream, writable, poi, false, (byte) 0, null);
      startRow = new byte[serializeStream.getLength()];
      System.arraycopy(serializeStream.getData(), 0, startRow, 0, serializeStream.getLength());
      return startRow;
    }

    PrimitiveCategory pc = poi.getPrimitiveCategory();
    switch (poi.getPrimitiveCategory()) {
    case INT:
      return Bytes.toBytes(((IntWritable) writable).get());
    case BOOLEAN:
      return Bytes.toBytes(((BooleanWritable) writable).get());
    case LONG:
      return Bytes.toBytes(((LongWritable) writable).get());
    case FLOAT:
      return Bytes.toBytes(((FloatWritable) writable).get());
    case DOUBLE:
      return Bytes.toBytes(((DoubleWritable) writable).get());
    case SHORT:
      return Bytes.toBytes(((ShortWritable) writable).get());
    case STRING:
      return Bytes.toBytes(((Text) writable).toString());
    case BYTE:
      return Bytes.toBytes(((ByteWritable) writable).get());

    default:
      throw new IOException("Type not supported " + pc);
    }
  }
Parse {@code jobConf} to create a {@link Scan} instance.
hbase-handler/src/java/org/apache/hadoop/hive/hbase/HiveHBaseInputFormatUtil.java