Class RequestedColumnImpl
java.lang.Object
org.apache.drill.exec.physical.resultSet.project.BaseRequestedColumn
org.apache.drill.exec.physical.resultSet.project.RequestedColumnImpl
- All Implemented Interfaces:
QualifierContainer
,RequestedColumn
Represents one name element. Like a
PathSegment.NameSegment
, except that this
version is an aggregate. If the projection list contains `a.b` and `a.c`,
then one name segment exists for a, and contains segments for both b and c.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
IfisArray()
returns true, reports the number of dimensions observed in projection.protected void
boolean
hasIndex
(int index) Report is a specific index was selected.boolean
Reports if the projection list included (only) specific element indexes.boolean[]
indexes()
Return a bitmap of the selected indexes.boolean
isArray()
Report whether the first qualifier is an array.boolean
isSimple()
boolean
isTuple()
Report whether the projection implies a tuple.boolean
Several consumers of this this mechanism process the "raw" projection list which can contain a combination of wildcard and otehr columns.int
maxIndex()
Return the maximum index value, if only explicit indexes were given.The internal qualifier information for the column.int
refCount()
toString()
Convert the projection to a string of the form:a[0,1,4]['*']{b, c d}
.tuple()
Return projection information for the column as a tuple.Methods inherited from class org.apache.drill.exec.physical.resultSet.project.BaseRequestedColumn
buildName, fullName, isRoot, name, nameEquals
-
Constructor Details
-
RequestedColumnImpl
-
-
Method Details
-
bumpRefCount
protected void bumpRefCount() -
refCount
public int refCount() -
qualifier
Description copied from interface:RequestedColumn
The internal qualifier information for the column. Generally not needed by clients; use the other informations to interpret the qualifier for you.- Specified by:
qualifier
in interfaceQualifierContainer
- Specified by:
qualifier
in interfaceRequestedColumn
- Returns:
- detailed column qualifier information, if the column was seen to be complex in the project list
-
requireQualifier
- Specified by:
requireQualifier
in interfaceQualifierContainer
-
isWildcard
public boolean isWildcard()Description copied from interface:RequestedColumn
Several consumers of this this mechanism process the "raw" projection list which can contain a combination of wildcard and otehr columns. For example:filename, *, dir0
. The requested tuple preserves the wildcard within the projection list so that, say, the projection mechanism can insert the actual data columns between the two implicit columns in the example.If a column is a wildcard, then none of the other methods apply, since this projected column represents any number or actual columns.
- Specified by:
isWildcard
in interfaceRequestedColumn
- Returns:
- if this column is the wildcard placeholder
-
isSimple
public boolean isSimple()- Specified by:
isSimple
in interfaceRequestedColumn
- Returns:
- true if this column has no qualifiers. Example:
a
.
-
isTuple
public boolean isTuple()Description copied from interface:RequestedColumn
Report whether the projection implies a tuple. Example:a.b
. Not that this method, and others can only tell if the projection implies a tuple; the actual column may be a tuple (MAP), but be projected simply. The map format also describes a DICT with a VARCHAR key.- Specified by:
isTuple
in interfaceRequestedColumn
- Returns:
- true if the column has a map-like projection.
-
tuple
Description copied from interface:RequestedColumn
Return projection information for the column as a tuple. If projection included references to nested columns (such asa.b, a.c
, then the tuple projection will list only the referenced columns. However, if projection is generic (m
), then we presume all columns of the map are projected and the returned object assumes all members are projected.- Specified by:
tuple
in interfaceRequestedColumn
- Returns:
- projection information for a (presumed) map column
-
isArray
public boolean isArray()Description copied from interface:RequestedColumn
Report whether the first qualifier is an array. Example:a[1]
. The array format also describes a DICT with an integer key.- Specified by:
isArray
in interfaceRequestedColumn
- Returns:
- true if the column must be an array.
-
hasIndexes
public boolean hasIndexes()Description copied from interface:RequestedColumn
Reports if the projection list included (only) specific element indexes. For example:a[2], a[5]
. The user could also project both indexes and the array:a[0], a
. In this caseisArray()
is {code true}, buthasIndexes()
isfalse
.- Specified by:
hasIndexes
in interfaceRequestedColumn
- Returns:
true
if the column has enumerated indexes,false
if the column was also projected as a whole, or if this column was not observed to be an array
-
hasIndex
public boolean hasIndex(int index) Description copied from interface:RequestedColumn
Report is a specific index was selected. Short cut for the other array methods. Used in cases such as thecolumns
column where the user can select specific elements (column) but not others.- Specified by:
hasIndex
in interfaceRequestedColumn
- Parameters:
index
- the array index to check- Returns:
true
if the array element was projected, either explicitly (a[3]
) or implicitly (a
). Returnsfalse
only ifhasIndexes()
returnstrue
(the user listed only explicit indexes) and the requested index is not among those requested (index >= maxIndex() || !indexes()[index]
)
-
maxIndex
public int maxIndex()Description copied from interface:RequestedColumn
Return the maximum index value, if only explicit indexes were given. Valid ifhasIndexes()
returns true.- Specified by:
maxIndex
in interfaceRequestedColumn
- Returns:
- the maximum array index value known to the projection, or
0 if
isArray()
isfalse
. Also returns 0 ifhasIndexe()
returnsfalse
, meaning that either the column was not observed to be an array, or was projected with both indexes and by itself:a[0], a
.
-
indexes
public boolean[] indexes()Description copied from interface:RequestedColumn
Return a bitmap of the selected indexes. Only valid ifhasIndexes()
returnstrue
.- Specified by:
indexes
in interfaceRequestedColumn
- Returns:
- a bitmap of the selected array indexes, or
null
ifhasIndexes()
returnsfalse
.
-
toString
Convert the projection to a string of the form:a[0,1,4]['*']{b, c d}
. The information here s insufficient to specify a type, it only specifies a pattern to which types are compatible. -
arrayDims
public int arrayDims()Description copied from interface:RequestedColumn
IfisArray()
returns true, reports the number of dimensions observed in projection. That is if projection isa[0][1]
, then this method returns 2.Note that, as with all projection-level information, this number reflects only what was in the project list; not what might be the number of dimensions in the actual input source.
- Specified by:
arrayDims
in interfaceRequestedColumn
- Returns:
- the maximum number of array dimensions observed in the
projection list, or 0 if this column was not observed to be an
array (if
isArray()
returnsfalse
.
-