示例#1
0
 @Override
 public Comparator<Object> getComparator(
     final PrestoContextRules rules, final PrestoField field, final Projection projection) {
   if (projection != null && projection.isSorted() && field.isReferenceField()) {
     return new FieldProjectionComparator(getPresto(), rules, field, projection);
   } else {
     return new FieldComparator(field, rules.isSortedAscendingField(field));
   }
 }
示例#2
0
  public List<Object> getValues(PrestoField field) {
    FieldDefinition fieldDefinition =
        FieldDefinition.getFieldDefinition(
            session.getTopicById(field.getId()), session.getTopicMap());

    Collection<? extends Object> fieldValues = fieldDefinition.getValues(topic);
    List<Object> result = new ArrayList<Object>(fieldValues.size());
    if (fieldDefinition.getFieldType() == FieldDefinition.FIELD_TYPE_ROLE
        && ((RoleField) fieldDefinition).getAssociationField().getArity() == 1) {
      result.add(!fieldValues.isEmpty());
    } else {
      for (Object value : fieldValues) {
        result.add(normalizeValue(topic, fieldDefinition, value));
      }
    }
    return result;
  }