Java Code Examples for cascading.tuple.Fields#merge()

The following examples show how to use cascading.tuple.Fields#merge() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Data.java    From plunger with Apache License 2.0 5 votes vote down vote up
/**
 * Specifies that the returned results be ordered by the specified {@link Fields}. Assume natural ordering of the
 * input types.
 */
public Data orderBy(Fields... fields) {
  if (fields != null && fields.length > 0) {
    sortFields = Fields.merge(fields);
  }
  return this;
}
 
Example 2
Source File: Data.java    From plunger with Apache License 2.0 5 votes vote down vote up
/**
 * Specifies that the returned results be restricted to the specified {@link Fields}.
 */
public Data withFields(Fields... fields) {
  if (fields != null && fields.length > 0) {
    for (Fields fieldsElement : fields) {
      // this check seems unnecessary, but Fields.merge() doesn't seem to handle this case
      if (fieldsElement == Fields.ALL) {
        withFields = Fields.ALL;
        return this;
      }
    }
    withFields = Fields.merge(fields);
  }
  return this;
}
 
Example 3
Source File: DataBuilder.java    From plunger with Apache License 2.0 5 votes vote down vote up
/**
 * Defines a subset of fields so that you can modify a smaller, pertinent collection of field values with
 * {@link #addTuple(Object...)}.
 */
public DataBuilder withFields(Fields... fields) {
  Fields fieldMask = Fields.merge(fields);
  try {
    this.fields.select(fieldMask);
    this.fieldMask = fieldMask;
  } catch (FieldsResolverException e) {
    throw new IllegalArgumentException("selected fields must be contained in record fields: selected fields="
        + fieldMask + ", source fields=" + this.fields);
  }

  return this;
}
 
Example 4
Source File: FunctionCallStub.java    From plunger with Apache License 2.0 5 votes vote down vote up
public Builder<C> withFields(Fields... fields) {
  Fields fieldMask = Fields.merge(fields);
  try {
    this.fields.select(fieldMask);
    this.fieldMask = fieldMask;
  } catch (FieldsResolverException e) {
    throw new IllegalArgumentException("selected fields must be contained in record fields: selected fields="
        + fieldMask + ", source fields=" + this.fields);
  }
  return this;
}