code: public void setGroupByFields(String... groupByFields) throws TupleMRException {
      failIfEmpty(groupByFields, "GroupBy fields can't be null or empty");
      failIfEmpty(schemas, "No schemas defined");
      failIfNotNull(this.groupByFields, "GroupBy fields already set : " + Arrays.toString(groupByFields));
      for (String field : groupByFields) {
        if (!fieldPresentInAllSchemas(field)) {
          throw new TupleMRException("Can't group by field '" + field
              + "' . Not present in all sources");
        }
        if (!fieldSameTypeInAllSources(field)) {
          throw new TupleMRException("Can't group by field '" + field
              + "' since its type differs among sources");
        }
      }
      this.groupByFields = Arrays.asList(groupByFields);
    }
docs: Defines the fields used to group tuples by. Similar to the GROUP BY in SQL.
  Tuples whose group-by fields are the same will be grouped and received in
  the same {@link TupleReducer#reduce} call.<p>
  <p/>
  When multiple schemas are set then the groupBy fields are used to perform
  co-grouping among tuples with different schemas. The groupBy fields
  specified in this method in a multi-source scenario must be present in
  every intermediate schema defined.<p>
  <p/>
  A field that's named differently among the intermediate schemas must be aliased in
  order to be used in the groupBy. For that purpose, use {@link #setFieldAliases(String, Aliases)}.