Class RelationType

java.lang.Object
io.trino.sql.analyzer.RelationType

@Immutable public class RelationType extends Object
TODO: this needs to be merged with RowType at some point (when the type system is unified)
  • Constructor Details

    • RelationType

      public RelationType(Field... fields)
    • RelationType

      public RelationType(List<Field> fields)
  • Method Details

    • indexOf

      public int indexOf(Field field)
      Gets the index of the specified field.
      Throws:
      IllegalArgumentException - when field is not found
    • getFieldByIndex

      public Field getFieldByIndex(int fieldIndex)
      Gets the field at the specified index.
    • getVisibleFields

      public Collection<Field> getVisibleFields()
      Gets only the visible fields. No assumptions should be made about the order of the fields returned from this method. To obtain the index of a field, call indexOf.
    • getVisibleFieldCount

      public int getVisibleFieldCount()
    • getAllFields

      public Collection<Field> getAllFields()
      Gets all fields including hidden fields. No assumptions should be made about the order of the fields returned from this method. To obtain the index of a field, call indexOf.
    • getAllFieldCount

      public int getAllFieldCount()
      Gets the count of all fields including hidden fields.
    • resolveVisibleFieldsWithRelationPrefix

      public List<Field> resolveVisibleFieldsWithRelationPrefix(Optional<QualifiedName> prefix)
      Gets all visible fields whose relation alias matches given prefix.
    • resolveFields

      public List<Field> resolveFields(QualifiedName name)
      Gets the index of all columns matching the specified name
    • canResolve

      public boolean canResolve(QualifiedName name)
    • joinWith

      public RelationType joinWith(RelationType other)
      Creates a new tuple descriptor containing all fields from this tuple descriptor and all fields from the specified tuple descriptor.
    • withAlias

      public RelationType withAlias(String relationAlias, List<String> columnAliases)
      Creates a new tuple descriptor with the relation, and, optionally, the columns aliased.
    • withOnlyVisibleFields

      public RelationType withOnlyVisibleFields()
      Creates a new tuple descriptor containing only the visible fields.
    • toString

      public String toString()
      Overrides:
      toString in class Object