Class PathSegment
java.lang.Object
org.apache.drill.common.expression.PathSegment
- Direct Known Subclasses:
PathSegment.ArraySegment
,PathSegment.NameSegment
Used to represent path to nested field within schema as a chain of path segments.
Where each segment in the chain may be either named or array segment.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Object
Holds original value associated with the path segment.protected final TypeProtos.MajorType
Indicates the type of original value. -
Constructor Summary
ConstructorDescriptionPathSegment
(PathSegment child, Object originalValue, TypeProtos.MajorType originalValueType) -
Method Summary
Modifier and TypeMethodDescriptionabstract PathSegment
clone()
abstract PathSegment
cloneWithNewChild
(PathSegment newChild) Makes copy of segment chain withnewChild
added at the end.boolean
contains
(PathSegment otherSeg) Check if another path is contained in this one.boolean
getChild()
int
hashCode()
abstract boolean
isArray()
boolean
abstract boolean
isNamed()
protected abstract boolean
segmentEquals
(PathSegment other) protected abstract int
-
Field Details
-
originalValue
Holds original value associated with the path segment. Used when reading data from DICT. -
originalValueType
Indicates the type of original value.- See Also:
-
-
Constructor Details
-
PathSegment
-
-
Method Details
-
cloneWithNewChild
Makes copy of segment chain withnewChild
added at the end.- Parameters:
newChild
- new child to add- Returns:
- full copy of segment chain with new child added at the end of chain
-
clone
-
getOriginalValue
-
getOriginalValueType
-
getNameSegment
-
getArraySegment
-
isArray
public abstract boolean isArray() -
isNamed
public abstract boolean isNamed() -
isLastPath
public boolean isLastPath() -
getChild
-
segmentHashCode
protected abstract int segmentHashCode() -
segmentEquals
-
hashCode
public int hashCode() -
equals
-
contains
Check if another path is contained in this one. This is useful for 2 cases. The first is checking if the other is lower down in the tree, below this path. The other is if a path is actually contained above the current one. Examples: [a] . contains( [a.b.c] ) returns true [a.b.c] . contains( [a] ) returns true This behavior is used for cases like scanning json in an event based fashion, when we arrive at a node in a complex type, we will know the complete path back to the root. This method can be used to determine if we need the data below. This is true in both the cases where the column requested from the user is below the current node (in which case we may ignore other nodes further down the tree, while keeping others). This is also the case if the requested path is further up the tree, if we know we are at position a.b.c and a.b was a requested column, we need to scan all of the data at and below the current a.b.c node.- Parameters:
otherSeg
- - path segment to check if it is contained below this one.- Returns:
- - is this a match
-