public W toWritable()

in pig/src/main/java/com/twitter/elephantbird/pig/util/AbstractWritableConverter.java [116:143]


  public W toWritable(Object value) throws IOException {
    if (value == null) {
      return null;
    }
    // route to appropriate method using Pig data type
    switch (DataType.findType(value)) {
      case DataType.BYTEARRAY:
        return toWritable((DataByteArray) value);
      case DataType.CHARARRAY:
        return toWritable((String) value);
      case DataType.INTEGER:
        return toWritable((Integer) value);
      case DataType.LONG:
        return toWritable((Long) value);
      case DataType.FLOAT:
        return toWritable((Float) value);
      case DataType.DOUBLE:
        return toWritable((Double) value);
      case DataType.MAP:
        return toWritable((Map<String, Object>) value);
      case DataType.TUPLE:
        return toWritable((Tuple) value);
      case DataType.BAG:
        return toWritable((DataBag) value);
      default:
        throw new IOException("Pig value class '" + value.getClass().getName() + "' is unsupported");
    }
  }