private static Object tupleFieldToSingleField ( FieldDescriptor fieldDescriptor , Object tupleField ) { // type convertion should match with ProtobufToPig.getPigScriptDataType switch ( fieldDescriptor . getType ( ) ) { case ENUM : return toEnumValueDescriptor ( fieldDescriptor , ( String ) tupleField ) ; case BOOL : return Boolean . valueOf ( ( Integer ) tupleField != 0 ) ; case BYTES : return ByteString . copyFrom ( ( ( DataByteArray ) tupleField ) . get ( ) ) ; default : return tupleField ; } }
Converts a tupleField string to its corresponding protobuf enum type if necessary otherwise returns the tupleField as is .