coral-beam-runtime/src/main/java/com/linkedin/beam/excution/BeamExecUtil.java
public static GenericRecord toAvroRecord(Object obj, Schema schema) {
    if (obj == null) {
      return null;
    }

    if (obj instanceof GenericRecord) {
      return (GenericRecord) obj;
    }

    if (obj instanceof Tuple) {
      final Tuple tuple = (Tuple) obj;
      try {
        if (isDynamicRecord(schema)) {
          return dynamicTuple2Avro(tuple, schema);
        } else {
          return AvroStorageDataConversionUtilities.packIntoAvro(tuple, schema);
        }
      } catch (Exception e) {
        throw new RuntimeException("Cannot convert " + obj + " into GenericRecord", e);
      }
    }
    throw new RuntimeException("Cannot convert " + obj.getClass().getName() + " object into GenericRecord");
  }
/**
   * Converts an object, which can be already an Avro GenericRecord or a Pig Tuple,
   * into an Avro GenericRecord. Returns null if object is null.
   */
Converts an object, which can be already an Avro GenericRecord or a Pig Tuple,
into an Avro GenericRecord. Returns null if object is null.
Converts an object which can be already an Avro GenericRecord or a Pig Tuple into an Avro GenericRecord . Returns null if object is null .
public static GenericRecord toAvroRecord(Object obj, Schema schema) {
    if (obj == null) {
      return null;
    }
    if (obj instanceof GenericRecord) {
      return (GenericRecord) obj;
    }
    if (obj instanceof Tuple) {
      final Tuple tuple = (Tuple) obj;
      try {
        if (isDynamicRecord(schema)) {
          return dynamicTuple2Avro(tuple, schema);
        } else {
          return AvroStorageDataConversionUtilities.packIntoAvro(tuple, schema);
        }
      } catch (Exception e) {
        throw new RuntimeException("Cannot convert " + obj + " into GenericRecord", e);
      }
    }
    throw new RuntimeException("Cannot convert " + obj.getClass().getName() + " object into GenericRecord");
  }
public static GenericRecord toAvroRecord ( Object obj , Schema schema ) { if ( obj == null ) { return null ; } if ( obj instanceof GenericRecord ) { return ( GenericRecord ) obj ; } if ( obj instanceof Tuple ) { final Tuple tuple = ( Tuple ) obj ; try { if ( isDynamicRecord ( schema ) ) { return dynamicTuple2Avro ( tuple , schema ) ; } else { return AvroStorageDataConversionUtilities . packIntoAvro ( tuple , schema ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Cannot convert " + obj + " into GenericRecord" , e ) ; } } throw new RuntimeException ( "Cannot convert " + obj . getClass ( ) . getName ( ) + " object into GenericRecord" ) ; }
Converts an object, which can be already an Avro GenericRecord or a Pig Tuple,
 into an Avro GenericRecord.
Converts an object which can be already an Avro GenericRecord or a Pig Tuple into an Avro GenericRecord .