if (o==null)
newKeyType = DataType.NULL;
switch (newKeyType) {
case DataType.BAG:
return new NullableBag((DataBag)o);
case DataType.BOOLEAN:
return new NullableBooleanWritable((Boolean)o);
case DataType.BYTEARRAY:
return new NullableBytesWritable(o);
case DataType.CHARARRAY:
return new NullableText((String)o);
case DataType.DOUBLE:
return new NullableDoubleWritable((Double)o);
case DataType.FLOAT:
return new NullableFloatWritable((Float)o);
case DataType.INTEGER:
return new NullableIntWritable((Integer)o);
case DataType.LONG:
return new NullableLongWritable((Long)o);
case DataType.BIGINTEGER:
return new NullableBigIntegerWritable((BigInteger)o);
case DataType.BIGDECIMAL:
return new NullableBigDecimalWritable((BigDecimal)o);
case DataType.DATETIME:
return new NullableDateTimeWritable((DateTime)o);
case DataType.TUPLE:
return new NullableTuple((Tuple)o);
case DataType.MAP: {
int errCode = 1068;
String msg = "Using Map as key not supported.";
throw new ExecException(msg, errCode, PigException.INPUT);
}
case DataType.NULL:
switch (keyType) {
case DataType.BAG:
NullableBag nbag = new NullableBag();
nbag.setNull(true);
return nbag;
case DataType.BOOLEAN:
NullableBooleanWritable nboolWrit = new NullableBooleanWritable();
nboolWrit.setNull(true);
return nboolWrit;