@Override
 public List<DataRecord> visit(Alias alias) {
   alias.getTypedExpression().accept(this);
   FieldMetadata aliasField =
       new SimpleTypeFieldMetadata(
           explicitProjection,
           false,
           lastField.isMany(),
           lastField.isMandatory(),
           alias.getAliasName(),
           lastField.getType(),
           Collections.<String>emptyList(),
           Collections.<String>emptyList(),
           Collections.<String>emptyList(),
           StringUtils.EMPTY);
   ValueBuilder previousValueBuilder = recordProjection.remove(lastField);
   if (previousValueBuilder == null) {
     AggregateValueBuilder previous = aggregateProjection.remove(lastField);
     aggregateProjection.put(aliasField, previous);
   } else {
     recordProjection.put(aliasField, previousValueBuilder);
   }
   return records;
 }
    @Override
    public List<DataRecord> visit(final Distinct distinct) {
      distinct.getExpression().accept(this);
      final ValueBuilder builder = recordProjection.remove(lastField);
      aggregateProjection.put(
          lastField,
          new AggregateValueBuilder() {

            @Override
            public Collection<Object> getValues(List<DataRecord> records) {
              Set<Object> distinctObjects = new HashSet<Object>();
              for (DataRecord record : records) {
                distinctObjects.add(builder.getValue(record));
              }
              return distinctObjects;
            }
          });
      return records;
    }