Class SchemaPath
java.lang.Object
org.apache.drill.common.expression.LogicalExpressionBase
org.apache.drill.common.expression.SchemaPath
- All Implemented Interfaces:
Iterable<LogicalExpression>
,LogicalExpression
- Direct Known Subclasses:
FieldReference
This is the path for the column in the table
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.common.expression.LogicalExpression
LogicalExpression.Se
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSchemaPath
(String simpleName, ExpressionPosition pos) Deprecated.SchemaPath
(PathSegment.NameSegment rootSegment) SchemaPath
(PathSegment.NameSegment rootSegment, ExpressionPosition pos) SchemaPath
(SchemaPath path) -
Method Summary
Modifier and TypeMethodDescription<T,
V, E extends Exception>
Taccept
(ExprVisitor<T, V, E> visitor, V value) boolean
contains
(SchemaPath path) static SchemaPath
create
(UserBitShared.NamePart namePart) boolean
getChild
(int index) getChild
(int index, Object originalValue, TypeProtos.MajorType valueType) getChild
(String childPath, Object originalValue, TypeProtos.MajorType valueType) static SchemaPath
getCompoundPath
(int n, String... path) ConstructsSchemaPath
based on givenpath
array up to nth element (inclusively).static SchemaPath
getCompoundPath
(String... path) Returns path string ofrootSegment
static SchemaPath
getSimplePath
(String name) Returns schema path with for arrays without index.int
hashCode()
boolean
isArray()
Return whether this name refers to an array.boolean
Return if this column is the special wildcard ("**") column which means to project all table columns.boolean
isLeaf()
Determine if this is a one-part name.boolean
A simple is a path where there are no repeated elements outside the lowest level of the path.iterator()
boolean
nameEquals
(String name) Returns if this is a simple column and the name matches the given name (ignoring case.) This does not check if the name is an entire match, only the the first (or only) part of the name matches.static SchemaPath
parseFromString
(String expr) Parses input string using the same rules which are used for the field in the query.rootName()
Return the root name: either the entire name (if one part) or the first part (if multi-part.) a: returns a a.b: returns a a[10]: returns atoExpr()
toString()
Methods inherited from class org.apache.drill.common.expression.LogicalExpressionBase
getCumulativeCost, getDescription, getPosition, getSelfCost, i
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DYNAMIC_STAR
- See Also:
-
STAR_COLUMN
-
-
Constructor Details
-
SchemaPath
-
SchemaPath
-
SchemaPath
Deprecated. -
SchemaPath
-
-
Method Details
-
getSimplePath
-
getCompoundPath
-
getCompoundPath
ConstructsSchemaPath
based on givenpath
array up to nth element (inclusively). Example: for case whenn = 2
andpath = {"a", "b", "c", "d", "e", ...}
the method returnsa.b
- Parameters:
n
- number of elements in path array to take when constructingSchemaPath
path
- column path used to construct schema path- Returns:
- schema path containing n - 1 children
-
getLastSegment
-
getAsNamePart
-
getUnIndexed
Returns schema path with for arrays without index. Is used to find column statistics in parquet metadata. Example: a.b.c[0] -> a.b.c, a[0].b[1] -> a.b- Returns:
- un-indexed schema path
-
parseFromString
Parses input string using the same rules which are used for the field in the query. If a string contains dot outside back-ticks, or there are no backticks in the string, will be createdSchemaPath
with thePathSegment.NameSegment
which contains one elsePathSegment.NameSegment
, etc. If a string contains [] thenPathSegment.ArraySegment
will be created.- Parameters:
expr
- input string to be parsed- Returns:
SchemaPath
instance
-
isSimplePath
public boolean isSimplePath()A simple is a path where there are no repeated elements outside the lowest level of the path.- Returns:
- Whether this path is a simple path.
-
isArray
public boolean isArray()Return whether this name refers to an array. The path must be an array if it ends with an array index; else it may or may not be an entire array.- Returns:
- true if the path ends with an array index, false otherwise
-
isLeaf
public boolean isLeaf()Determine if this is a one-part name. In general, special columns work only if they are single-part names.- Returns:
- true if this is a one-part name, false if this is a multi-part name (with either map member or array index parts.)
-
isDynamicStar
public boolean isDynamicStar()Return if this column is the special wildcard ("**") column which means to project all table columns.- Returns:
- true if the column is "**"
-
nameEquals
Returns if this is a simple column and the name matches the given name (ignoring case.) This does not check if the name is an entire match, only the the first (or only) part of the name matches. Also checkisLeaf()
to check for a single-part name.- Parameters:
name
- name to match- Returns:
- true if this is a single-part column with that name.
-
rootName
Return the root name: either the entire name (if one part) or the first part (if multi-part.)- a: returns a
- a.b: returns a
- a[10]: returns a
- Returns:
- the root (or only) name
-
accept
- Throws:
E extends Exception
-
getChild
-
getChild
-
getChild
-
getChild
-
getRootSegment
-
getAsUnescapedPath
-
getMajorType
- Specified by:
getMajorType
in interfaceLogicalExpression
- Overrides:
getMajorType
in classLogicalExpressionBase
-
hashCode
public int hashCode() -
equals
-
contains
-
iterator
-
toString
-
toExpr
-
getRootSegmentPath
Returns path string ofrootSegment
- Returns:
- path string of
rootSegment
-
SchemaPath(NameSegment)
orSchemaPath(NameSegment, ExpressionPosition)
instead