Class AvroSchemaUtil


  • public class AvroSchemaUtil
    extends Object
    • Method Detail

      • findConversionFor

        public static org.apache.avro.Conversion<?> findConversionFor​(String typeName)
      • valueOf

        public static FieldSpec.DataType valueOf​(org.apache.avro.Schema.Type avroType)
        Returns the data type stored in Pinot that is associated with the given Avro type.
      • isPrimitiveType

        public static boolean isPrimitiveType​(org.apache.avro.Schema.Type avroType)
        Returns:
        if the given avro type is a primitive type.
      • toAvroSchemaJsonObject

        public static com.fasterxml.jackson.databind.node.ObjectNode toAvroSchemaJsonObject​(FieldSpec fieldSpec)
      • applyLogicalType

        public static Object applyLogicalType​(org.apache.avro.Schema.Field field,
                                              Object value)
        Applies the logical type conversion to the given Avro record field. If there isn't a logical type for the value then the value is returned unchanged. If there is a logical type associated to the field but no Avro conversion is known for the type then the value is returned unchanged.
        Parameters:
        field - Avro field spec
        value - Value of the field
        Returns:
        Converted value as per the logical type in the spec, or the unchanged value if a logical type or conversion can't be found.