Class AvroRecordUtils

java.lang.Object
com.linkedin.venice.utils.AvroRecordUtils

public class AvroRecordUtils extends Object
  • Method Details

    • prefillAvroRecordWithDefaultValue

      public static <T extends org.apache.avro.specific.SpecificRecord> T prefillAvroRecordWithDefaultValue(T recordType)
      This function is used to pre-fill the default value defined in schema. So far, it only support the followings: 1. Only top-level fields are supported. 2. All the primitive types are supported. 3. For union, only `null` default is supported. 4. For array/map, only empty list/map are supported. Other than the above, this function will throw exception. TODO: once the whole stack migrates to the modern avro version (avro-1.7+), we could leverage SpecificRecord builder to prefill the default value, which will be much more powerful.
      Type Parameters:
      T -
      Parameters:
      recordType -
      Returns:
    • clearRecord

      public static void clearRecord(org.apache.avro.generic.GenericRecord record)