public static Schema subSetOf ( String newName , Schema schema , String ... subSetFields ) { List < Field > newSchema = new ArrayList < Field > ( ) ; for ( String subSetField : subSetFields ) { newSchema . add ( schema . getField ( subSetField ) ) ; } return new Schema ( newName , newSchema ) ; }
Creates a subset of the input Schema exactly with the fields whose names are specified . The name of the schema is also specified as a parameter .