Class RequestedTupleImpl

All Implemented Interfaces:

public class RequestedTupleImpl extends Object implements RequestedTuple
Represents an explicit projection at some tuple level. A tuple is the top-level row or a map.

A column is projected if it is explicitly listed in the selection list.

If a column is a map, then the projection for the map's columns is based on two rules:

  1. If the projection list includes at least one explicit mention of a map member, then include only those columns explicitly listed.
  2. If the projection at the parent level lists only the map column itself (which the projection can't know is a map), then assume this implies all columns, as if the entry where "map.*".

If m turns out to be a map, project all members of m.
Column m must be a map. Project only column a.
m, m.a
Tricky case. We interpret this as projecting only the "a" element of map m.

The projection set is built from a list of columns, represented as SchemaPath objects, provided by the physical plan. The structure of SchemaPath is a bit awkward:

  • SchemaPath> is a wrapper for a column which directly holds the NameSegment for the top-level column.
  • NameSegment holds a name. This can be a top name such as `a`, or parts of a compound name such as `a`.`b`. Each NameSegment has a "child" that points to the option following parts of the name.
  • <PathSegment is the base class for the parts of a name.
  • ArraySegment is the other kind of name part and represents an array index such as the "[1]" in `columns`[1].
    • The parser considers names and array indexes. Example:


      The projection information is a pattern which supports queries of the form "is this column projected", and "if projected, is the projection consistent with such-and-so concrete type?" Clients should not try to work out the meaning of the pattern: doing so is very complex. Instead, do the following:
       String colName = ...;
       ColumnMetadata colDef = ...;
       InputTupleProjection tupleProj = ...
       if (tupleProj.isProjected(colName)) {
         if (!tupleProj.isComsistentWith(colDef)) {
           // Raise an error
         // Handle a projected column.