Package io.prestosql.sql.analyzer
Class RelationType
- java.lang.Object
-
- io.prestosql.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 Summary
Constructors Constructor Description RelationType(Field... fields)
RelationType(List<Field> fields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canResolve(QualifiedName name)
int
getAllFieldCount()
Gets the count of all fields including hidden fields.Collection<Field>
getAllFields()
Gets all fields including hidden fields.Field
getFieldByIndex(int fieldIndex)
Gets the field at the specified index.int
getVisibleFieldCount()
Collection<Field>
getVisibleFields()
Gets only the visible fields.int
indexOf(Field field)
Gets the index of the specified field.RelationType
joinWith(RelationType other)
Creates a new tuple descriptor containing all fields from this tuple descriptor and all fields from the specified tuple descriptor.List<Field>
resolveFields(QualifiedName name)
Gets the index of all columns matching the specified nameList<Field>
resolveVisibleFieldsWithRelationPrefix(Optional<QualifiedName> prefix)
Gets all visible fields whose relation alias matches given prefix.String
toString()
RelationType
withAlias(String relationAlias, List<String> columnAliases)
Creates a new tuple descriptor with the relation, and, optionally, the columns aliased.RelationType
withOnlyVisibleFields()
Creates a new tuple descriptor containing only the visible fields.
-
-
-
Method Detail
-
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.
-
-