@SuppressWarnings("unchecked")
  public HiveTypeInfo generateHiveTypeInfoFromMetadataField(Field hiveTypeInfoField) throws StageException {
    if (hiveTypeInfoField.getType() == Field.Type.MAP) {
      Map<String, Field> fields = (Map<String, Field>) hiveTypeInfoField.getValue();
      if (!fields.containsKey(HiveMetastoreUtil.TYPE)
          || !fields.containsKey(HiveMetastoreUtil.EXTRA_INFO)) {
        throw new StageException(Errors.HIVE_17, HiveMetastoreUtil.TYPE_INFO);
      }
      HiveType hiveType = HiveType.getHiveTypeFromString(fields.get(HiveMetastoreUtil.TYPE).getValueAsString());
      String comment = "";
      if(fields.containsKey(HiveMetastoreUtil.COMMENT)) {
        comment = fields.get(HiveMetastoreUtil.COMMENT).getValueAsString();
      }
      return generateHiveTypeInfoFromMetadataField(hiveType, comment, fields.get(HiveMetastoreUtil.EXTRA_INFO));
    } else {
      throw new StageException(Errors.HIVE_17, HiveMetastoreUtil.TYPE_INFO);
    }
  }
@ SuppressWarnings ( "unchecked" ) public HiveTypeInfo generateHiveTypeInfoFromMetadataField ( Field hiveTypeInfoField ) throws StageException { if ( hiveTypeInfoField . getType ( ) == Field . Type . MAP ) { Map < String , Field > fields = ( Map < String , Field > ) hiveTypeInfoField . getValue ( ) ; if ( ! fields . containsKey ( HiveMetastoreUtil . TYPE ) || ! fields . containsKey ( HiveMetastoreUtil . EXTRA_INFO ) ) { throw new StageException ( Errors . HIVE_17 , HiveMetastoreUtil . TYPE_INFO ) ; } HiveType hiveType = HiveType . getHiveTypeFromString ( fields . get ( HiveMetastoreUtil . TYPE ) . getValueAsString ( ) ) ; String comment = "" ; if ( fields . containsKey ( HiveMetastoreUtil . COMMENT ) ) { comment = fields . get ( HiveMetastoreUtil . COMMENT ) . getValueAsString ( ) ; } return generateHiveTypeInfoFromMetadataField ( hiveType , comment , fields . get ( HiveMetastoreUtil . EXTRA_INFO ) ) ; } else { throw new StageException ( Errors . HIVE_17 , HiveMetastoreUtil . TYPE_INFO ) ; } }
Generate {@link HiveTypeInfo} from the Metadata Record <br>.
(Reverse of {@link #generateHiveTypeInfoFieldForMetadataRecord(HiveTypeInfo)})

@throws StageException if the metadata field is not valid.
@param hiveTypeInfoField hiveTypeInfoField
@return {@link HiveTypeInfo}
@throws StageException If the record has invalid