Class ProjectionColumn

  • All Implemented Interfaces:
    Serializable

    public class ProjectionColumn
    extends Object
    implements Serializable
    The ProjectionColumn applies to describe the information of the transformation column. If it only has column info, it describes the data column. If it has column info and expression info, it describes the user-defined computed columns.

    A projection column contains:

    • column: column information parsed from projection.
    • expression: a string for column expression split from the user-defined projection.
    • scriptExpression: a string for column script expression compiled from the column expression.
    • originalColumnNames: a list for recording the name of all columns used by the column expression.
    See Also:
    Serialized Form
    • Method Detail

      • getColumn

        public Column getColumn()
      • getColumnName

        public String getColumnName()
      • getDataType

        public DataType getDataType()
      • getExpression

        public String getExpression()
      • getScriptExpression

        public String getScriptExpression()
      • getOriginalColumnNames

        public List<String> getOriginalColumnNames()
      • getColumnNameMapAsString

        public String getColumnNameMapAsString()
      • isValidTransformedProjectionColumn

        public boolean isValidTransformedProjectionColumn()
      • ofForwarded

        public static ProjectionColumn ofForwarded​(Column column,
                                                   String mappedColumnName)
        This projection is created with a plain column name.
        Just like column id in id, name AS new_name, age + 1 AS new_age.
        Comments and default expressions will be intact.
      • ofAliased

        public static ProjectionColumn ofAliased​(Column column,
                                                 String newName,
                                                 String mappedColumnName)
        This projection is created with a simple $id$ AS $new_id$ expression.
        Just like column new_name in id, name AS new_name, age + 1 AS new_age.
        Comments and default expressions will be intact.
      • ofCalculated

        public static ProjectionColumn ofCalculated​(String columnName,
                                                    DataType dataType,
                                                    String expression,
                                                    String scriptExpression,
                                                    List<String> originalColumnNames,
                                                    Map<String,​String> columnNameMap)
        This projection is created with a complex calculation expression.
        Just like column new_age in id, name AS new_name, age + 1 AS new_age.
        No comments nor default expressions will be kept.