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

public class SchemaPath extends LogicalExpressionBase
This is the path for the column in the table
  • Field Details

  • Constructor Details

  • Method Details

    • getSimplePath

      public static SchemaPath getSimplePath(String name)
    • getCompoundPath

      public static SchemaPath getCompoundPath(String... path)
    • getCompoundPath

      public static SchemaPath getCompoundPath(int n, String... path)
      Constructs SchemaPath based on given path array up to nth element (inclusively). Example: for case when n = 2 and path = {"a", "b", "c", "d", "e", ...} the method returns a.b
      Parameters:
      n - number of elements in path array to take when constructing SchemaPath
      path - column path used to construct schema path
      Returns:
      schema path containing n - 1 children
    • getLastSegment

      public PathSegment getLastSegment()
    • getAsNamePart

      public UserBitShared.NamePart getAsNamePart()
    • create

      public static SchemaPath create(UserBitShared.NamePart namePart)
    • getUnIndexed

      public SchemaPath 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

      public static SchemaPath parseFromString(String expr)
      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 created SchemaPath with the PathSegment.NameSegment which contains one else PathSegment.NameSegment, etc. If a string contains [] then PathSegment.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

      public 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. Also check isLeaf() 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

      public String 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

      public <T, V, E extends Exception> T accept(ExprVisitor<T,V,E> visitor, V value) throws E
      Throws:
      E extends Exception
    • getChild

      public SchemaPath getChild(String childPath)
    • getChild

      public SchemaPath getChild(String childPath, Object originalValue, TypeProtos.MajorType valueType)
    • getChild

      public SchemaPath getChild(int index)
    • getChild

      public SchemaPath getChild(int index, Object originalValue, TypeProtos.MajorType valueType)
    • getRootSegment

      public PathSegment.NameSegment getRootSegment()
    • getAsUnescapedPath

      public String getAsUnescapedPath()
    • getMajorType

      public TypeProtos.MajorType getMajorType()
      Specified by:
      getMajorType in interface LogicalExpression
      Overrides:
      getMajorType in class LogicalExpressionBase
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • contains

      public boolean contains(SchemaPath path)
    • iterator

      public Iterator<LogicalExpression> iterator()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toExpr

      public String toExpr()
    • getRootSegmentPath

      public String getRootSegmentPath()
      Returns path string of rootSegment
      Returns:
      path string of rootSegment