java.lang.Object
org.apache.drill.exec.physical.resultSet.project.Projections

public class Projections extends Object
Converts a projection list passed to an operator into a scan projection list, coalescing multiple references to the same column into a single reference.
  • Method Details

    • projectAll

      public static RequestedTuple projectAll()
    • projectNone

      public static RequestedTuple projectNone()
    • parse

      public static RequestedTuple parse(Collection<SchemaPath> projList)
      Parse a projection list. The list should consist of a list of column names; or wildcards. An empty list means nothing is projected. A null list means everything is projected (that is, a null list here is equivalent to a wildcard in the SELECT statement.)

      The projection list may include both a wildcard and column names (as in the case of implicit columns.) This results in a final list that both says that everything is projected, and provides the list of columns.

      Parsing is used at two different times. First, to parse the list from the physical operator. This has the case above: an explicit wildcard and/or additional columns. Then, this class is used again to prepare the physical projection used when reading. In this case, wildcards should be removed, implicit columns pulled out, and just the list of read-level columns should remain.

      Parameters:
      projList - the list of projected columns, or null if no projection is to be done
      Returns:
      a projection set that implements the specified projection
    • build

      public static RequestedTuple build(List<RequestedColumn> projList)
      Create a requested tuple projection from a rewritten top-level projection list. The columns within the list have already been parsed to pick out arrays, maps and scalars. The list must not include the wildcard: a wildcard list must be passed in as a null list. An empty list means project nothing. Null list means project all, else project only the columns in the list.
      Parameters:
      projList - top-level, parsed columns
      Returns:
      the tuple projection for the top-level row
    • excludeFromWildcard

      public static boolean excludeFromWildcard(ColumnMetadata col)
      Reports whether the column is a special column which should not be expanded in a wildcard. Used for specialized columns in readers such as the Log format.