code: public RelationType withAlias(String relationAlias, List<String> columnAliases)
      {
          if (columnAliases != null) {
              checkArgument(columnAliases.size() == visibleFields.size(),
                      "Column alias list has %s entries but '%s' has %s columns available",
                      columnAliases.size(),
                      relationAlias,
                      visibleFields.size());
          }
  
          ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder();
          for (int i = 0; i < allFields.size(); i++) {
              Field field = allFields.get(i);
              Optional<String> columnAlias = field.getName();
              if (columnAliases == null) {
                  fieldsBuilder.add(Field.newQualified(
                          QualifiedName.of(relationAlias),
                          columnAlias,
                          field.getType(),
                          field.isHidden(),
                          field.getOriginTable(),
                          field.getOriginColumnName(),
                          field.isAliased()));
              }
              else if (!field.isHidden()) {
                  // hidden fields are not exposed when there are column aliases
                  columnAlias = Optional.of(columnAliases.get(i));
                  fieldsBuilder.add(Field.newQualified(
                          QualifiedName.of(relationAlias),
                          columnAlias,
                          field.getType(),
                          false,
                          field.getOriginTable(),
                          field.getOriginColumnName(),
                          field.isAliased()));
              }
          }
  
          return new RelationType(fieldsBuilder.build());
      }
docs: Creates a new tuple descriptor with the relation, and, optionally, the columns aliased.