class SchemaUtil {

  static boolean compareSchemaFieldType(Schema.FieldType a, Schema.FieldType b) {
    if (a.getTypeName().equals(b.getTypeName())) {
      return !a.getTypeName().equals(Schema.TypeName.LOGICAL_TYPE)
          || compareSchemaFieldType(
              a.getLogicalType().getBaseType(), b.getLogicalType().getBaseType());
    } else if (a.getTypeName().isLogicalType()) {
      return a.getLogicalType().getBaseType().getTypeName().equals(b.getTypeName());
    } else if (b.getTypeName().isLogicalType()) {
      return b.getLogicalType().getBaseType().getTypeName().equals(a.getTypeName());
    }
    return false;
  }

}