parquet-column/src/main/java/org/apache/parquet/schema/GroupType.java
List<Type> mergeFields(GroupType toMerge, boolean strict) {
    List<Type> newFields = new ArrayList<Type>();
    // merge existing fields
    for (Type type : this.getFields()) {
      Type merged;
      if (toMerge.containsField(type.getName())) {
        Type fieldToMerge = toMerge.getType(type.getName());
        if (type.getLogicalTypeAnnotation() != null && !type.getLogicalTypeAnnotation().equals(fieldToMerge.getLogicalTypeAnnotation())) {
          throw new IncompatibleSchemaModificationException("cannot merge logical type " + fieldToMerge.getLogicalTypeAnnotation() + " into " + type.getLogicalTypeAnnotation());
        }
        merged = type.union(fieldToMerge, strict);
      } else {
        merged = type;
      }
      newFields.add(merged);
    }
    // add new fields
    for (Type type : toMerge.getFields()) {
      if (!this.containsField(type.getName())) {
        newFields.add(type);
      }
    }
    return newFields;
  }
List<Type> mergeFields(GroupType toMerge, boolean strict) {
    List<Type> newFields = new ArrayList<Type>();
    // merge existing fields
    for (Type type : this.getFields()) {
      Type merged;
      if (toMerge.containsField(type.getName())) {
        Type fieldToMerge = toMerge.getType(type.getName());
        if (type.getLogicalTypeAnnotation() != null && !type.getLogicalTypeAnnotation().equals(fieldToMerge.getLogicalTypeAnnotation())) {
          throw new IncompatibleSchemaModificationException("cannot merge logical type " + fieldToMerge.getLogicalTypeAnnotation() + " into " + type.getLogicalTypeAnnotation());
        }
        merged = type.union(fieldToMerge, strict);
      } else {
        merged = type;
      }
      newFields.add(merged);
    }
    // add new fields
    for (Type type : toMerge.getFields()) {
      if (!this.containsField(type.getName())) {
        newFields.add(type);
      }
    }
    return newFields;
  }
List < Type > mergeFields ( GroupType toMerge , boolean strict ) { List < Type > newFields = new ArrayList < Type > ( ) ; // merge existing fields for ( Type type : this . getFields ( ) ) { Type merged ; if ( toMerge . containsField ( type . getName ( ) ) ) { Type fieldToMerge = toMerge . getType ( type . getName ( ) ) ; if ( type . getLogicalTypeAnnotation ( ) != null && ! type . getLogicalTypeAnnotation ( ) . equals ( fieldToMerge . getLogicalTypeAnnotation ( ) ) ) { throw new IncompatibleSchemaModificationException ( "cannot merge logical type " + fieldToMerge . getLogicalTypeAnnotation ( ) + " into " + type . getLogicalTypeAnnotation ( ) ) ; } merged = type . union ( fieldToMerge , strict ) ; } else { merged = type ; } newFields . add ( merged ) ; } // add new fields for ( Type type : toMerge . getFields ( ) ) { if ( ! this . containsField ( type . getName ( ) ) ) { newFields . add ( type ) ; } } return newFields ; }
produces the list of fields resulting from merging toMerge into the fields of this
@param toMerge the group containing the fields to merge
@param strict should schema primitive types match
@return the merged list
produces the list of fields resulting from merging toMerge into the fields of this