hive-protolib/src/main/java/com/streamsets/pipeline/stage/lib/hive/HiveMetastoreUtil.java
public static String generateAvroSchema(Map<String, HiveTypeInfo> typeInfo, String qualifiedName)
      throws HiveStageCheckedException {
    Utils.checkNotNull(typeInfo, "Error TypeInfo cannot be null");
    // Avro doesn't allow "`" in names, so we're dropping those from qualified name
    AvroHiveSchemaGenerator gen = new AvroHiveSchemaGenerator(qualifiedName.replace("`", ""));
    try {
      return gen.inferSchema(typeInfo);
    } catch (StageException e) {
      //So that any error to generate avro schema will result in onRecordErrorException and routed to error lane.
      throw new HiveStageCheckedException(e.getErrorCode(), e.getParams());
    }
  }
public static String generateAvroSchema(Map<String, HiveTypeInfo> typeInfo, String qualifiedName)
      throws HiveStageCheckedException {
    Utils.checkNotNull(typeInfo, "Error TypeInfo cannot be null");
    // Avro doesn't allow "`" in names, so we're dropping those from qualified name
    AvroHiveSchemaGenerator gen = new AvroHiveSchemaGenerator(qualifiedName.replace("`", ""));
    try {
      return gen.inferSchema(typeInfo);
    } catch (StageException e) {
      //So that any error to generate avro schema will result in onRecordErrorException and routed to error lane.
      throw new HiveStageCheckedException(e.getErrorCode(), e.getParams());
    }
  }
Generate avro schema from column name and type information. typeInfo in 1st parameter
needs to contain precision and scale information in the value(HiveTypeInfo).
The 2nd parameter qualifiedName will be the name of Avro Schema.
@param typeInfo  Record structure
@param qualifiedName qualified name that will be the name of generated avro schema
@return String avro schema
@throws HiveStageCheckedException