parquet-cli/src/main/java/org/apache/parquet/cli/util/Schemas.java
private static Schema mergeOrUnion(Schema left, Schema right) {
    Schema merged = mergeOnly(left, right);
    if (merged != null) {
      return merged;
    }
    return union(left, right);
  }
private static Schema mergeOrUnion(Schema left, Schema right) {
    Schema merged = mergeOnly(left, right);
    if (merged != null) {
      return merged;
    }
    return union(left, right);
  }
Merges two {@link Schema} instances or returns {@code null}.
<p>
The two schemas are merged if they are the same type. Records are merged
if the two records have the same name or have no names but have a
significant number of shared fields.
<p>
@see {@link #mergeOrUnion} to return a union when a merge is not possible.

@param left a {@code Schema}
@param right a {@code Schema}
@return a {@code Schema} for both types