Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Classes | |
enum | PathType |
Public Member Functions | |
Path (TupleDescriptor rootDesc, List< String > rawPath) | |
Path (Table rootTable, List< String > rawPath) | |
Path (Path rootPath, List< String > relRawPath) | |
boolean | resolve () |
Table | getRootTable () |
TupleDescriptor | getRootDesc () |
List< String > | getRawPath () |
boolean | isResolved () |
List< Type > | getMatchedTypes () |
List< Integer > | getMatchedPositions () |
boolean | hasNonDestCollection () |
String | getFirstCollectionName () |
Type | getFirstCollectionType () |
Type | destType () |
Table | destTable () |
Column | destColumn () |
TupleDescriptor | destTupleDesc () |
List< String > | getFullyQualifiedRawPath () |
List< Integer > | getAbsolutePath () |
String | toString () |
Static Public Member Functions | |
static StructType | getTypeAsStruct (Type t) |
static ArrayList< String > | createRawPath (String rootAlias, String fieldName) |
static Path | createRelPath (Path rootPath, String...fieldNames) |
Static Public Attributes | |
static final String | ARRAY_ITEM_FIELD_NAME = "item" |
static final String | ARRAY_POS_FIELD_NAME = "pos" |
static final String | MAP_KEY_FIELD_NAME = "key" |
static final String | MAP_VALUE_FIELD_NAME = "value" |
Private Attributes | |
final List< String > | rawPath_ |
final TupleDescriptor | rootDesc_ |
final Table | rootTable_ |
final Path | rootPath_ |
final List< Type > | matchedTypes_ = Lists.newArrayList() |
final List< Integer > | matchedPositions_ = Lists.newArrayList() |
int | firstCollectionPathIdx_ = -1 |
int | firstCollectionTypeIdx_ = -1 |
boolean | isResolved_ = false |
List< Integer > | absolutePath_ = null |
Represents a resolved or unresolved dot-separated path that is rooted at a registered tuple descriptor, catalog table/view, or an existing resolved path.
This class implements the resolution logic for mapping an implicit or explicit raw path to the corresponding physical types/positions in the schema tree.
Implicit vs. Explicit Paths The item of an array and the key/value of maps are accessed via their implicit field names. However, if the type of an array item or a map value is a struct, then we allow omitting the explicit reference to the struct type in paths for accessing fields within that struct as a shorthand for user convenience. An explicit reference to the struct type is always legal. Paths that explicitly reference such a struct are "physical" because they typically map exactly to the schema representation in the underlying storage format (e.g. Parquet/Avro). Paths that omit the struct reference are called "implicit". During resolution, explicit paths are always preferred over implicit paths for resolving ambiguities.
Example create table d.t ( c array<struct<f:int,item:int,pos:int>> );
select ... from d.t.c d.t.c <– resolves to type array<struct<f:int,item:int,pos:int>> c alias <– type struct<item:struct<f:int,item:int,pos:int>,pos:bigint>>
select c.item.f, c.f from d.t.c c.item.f <– explicit path to "f" c.f <– implicit path to "f", skips "item" reference (same for the unqualified versions item.f and f)
select c.item, c.item.item from d.t.c c.item <– explicit path to "item" struct of type struct<f:int,item:string> c.item.item <– explicit path to string "item"; there is no logical path to the string "item" due to the "item" name conflict c.pos <– explicit path to "pos" of type bigint c.item.pos <– explicit path to "pos" of type int; there is no logical path to the int "pos" due to the "pos" name conflict (same for unqualified versions item, item.item, pos, item.pos)
Please refer to TestImplicitAndExplicitPaths() for analogous examples for maps.
|
inline |
Constructs a Path rooted at the given rootDesc.
Definition at line 122 of file Path.java.
References com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, com.cloudera.impala.analysis.Path.rootPath_, and com.cloudera.impala.analysis.Path.rootTable_.
Referenced by com.cloudera.impala.analysis.Path.createRelPath().
|
inline |
Constructs a Path rooted at the given rootTable.
Definition at line 134 of file Path.java.
References com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, com.cloudera.impala.analysis.Path.rootPath_, and com.cloudera.impala.analysis.Path.rootTable_.
|
inline |
Constructs a new unresolved path relative to an existing resolved path.
Definition at line 146 of file Path.java.
References com.cloudera.impala.analysis.Path.firstCollectionPathIdx_, com.cloudera.impala.analysis.Path.firstCollectionTypeIdx_, com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, com.cloudera.impala.analysis.Path.rootPath_, and com.cloudera.impala.analysis.Path.rootTable_.
|
inlinestatic |
Returns a raw path from a known root alias and field name.
Definition at line 350 of file Path.java.
Referenced by com.cloudera.impala.analysis.TableRef.analyzeJoin().
|
inlinestatic |
Definition at line 356 of file Path.java.
References com.cloudera.impala.analysis.Path.Path().
|
inline |
Returns the destination Column of this path, or null if the destination of this path is not a Column. This path must be rooted at a table or a tuple descriptor corresponding to a table for the destination to be a Column.
Definition at line 292 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.rawPath_, and com.cloudera.impala.analysis.Path.rootTable_.
|
inline |
Definition at line 279 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.matchedTypes_, com.cloudera.impala.analysis.Path.rootDesc_, and com.cloudera.impala.analysis.Path.rootTable_.
Referenced by com.cloudera.impala.analysis.TupleDescriptor.setPath().
|
inline |
Returns the destination tuple descriptor of this path, or null if the destination of this path is not a registered alias.
Definition at line 302 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.matchedTypes_, and com.cloudera.impala.analysis.Path.rootDesc_.
|
inline |
Definition at line 271 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.matchedTypes_, com.cloudera.impala.analysis.Path.rootDesc_, and com.cloudera.impala.analysis.Path.rootTable_.
|
inline |
Returns the absolute physical path in positions starting from the schema root to the destination of this path.
Definition at line 325 of file Path.java.
References com.cloudera.impala.analysis.Path.absolutePath_, com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.matchedPositions_, and com.cloudera.impala.analysis.Path.rootDesc_.
|
inline |
Definition at line 259 of file Path.java.
References com.cloudera.impala.analysis.Path.firstCollectionPathIdx_, and com.cloudera.impala.analysis.Path.isResolved_.
|
inline |
Definition at line 265 of file Path.java.
References com.cloudera.impala.analysis.Path.firstCollectionTypeIdx_, and com.cloudera.impala.analysis.Path.isResolved_.
|
inline |
Definition at line 308 of file Path.java.
References com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, and com.cloudera.impala.analysis.Path.rootTable_.
|
inline |
Definition at line 248 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, and com.cloudera.impala.analysis.Path.matchedPositions_.
|
inline |
Definition at line 243 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_, and com.cloudera.impala.analysis.Path.matchedTypes_.
|
inline |
Definition at line 240 of file Path.java.
References com.cloudera.impala.analysis.Path.rawPath_.
Referenced by com.cloudera.impala.analysis.SlotDescriptor.setPath().
|
inline |
Definition at line 239 of file Path.java.
References com.cloudera.impala.analysis.Path.rootDesc_.
Referenced by com.cloudera.impala.analysis.CollectionTableRef.analyze().
|
inline |
Definition at line 238 of file Path.java.
References com.cloudera.impala.analysis.Path.rootTable_.
Referenced by com.cloudera.impala.analysis.TableRef.analyze().
|
inlinestatic |
If the given type is a collection, returns a collection struct type representing named fields of its explicit path. Returns the given type itself if it is already a struct. Requires that the given type is a complex type.
Definition at line 227 of file Path.java.
References com.cloudera.impala.catalog.Type.isArrayType(), and com.cloudera.impala.catalog.Type.isStructType().
Referenced by com.cloudera.impala.analysis.Path.resolve().
|
inline |
Definition at line 253 of file Path.java.
References com.cloudera.impala.analysis.Path.firstCollectionPathIdx_, and com.cloudera.impala.analysis.Path.isResolved_.
|
inline |
Definition at line 241 of file Path.java.
References com.cloudera.impala.analysis.Path.isResolved_.
|
inline |
Resolves this path in the context of the root tuple descriptor / root table or continues resolving this relative path from an existing root path. Returns true if the path could be fully resolved, false otherwise. A failed resolution leaves this Path in a partially resolved state.
Definition at line 169 of file Path.java.
References com.cloudera.impala.analysis.Path.firstCollectionPathIdx_, com.cloudera.impala.analysis.Path.firstCollectionTypeIdx_, com.cloudera.impala.catalog.StructField.getType(), com.cloudera.impala.analysis.Path.getTypeAsStruct(), com.cloudera.impala.analysis.Path.isResolved_, com.cloudera.impala.analysis.Path.matchedPositions_, com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, com.cloudera.impala.analysis.Path.rootPath_, and com.cloudera.impala.analysis.Path.rootTable_.
Referenced by com.cloudera.impala.analysis.TableRef.analyzeJoin().
|
inline |
Definition at line 335 of file Path.java.
References com.cloudera.impala.analysis.Path.rawPath_, com.cloudera.impala.analysis.Path.rootDesc_, and com.cloudera.impala.analysis.Path.rootTable_.
Referenced by com.cloudera.impala.analysis.HdfsUri.analyze(), and com.cloudera.impala.analysis.SlotDescriptor.debugString().
|
private |
Definition at line 117 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.getAbsolutePath().
|
static |
Definition at line 76 of file Path.java.
Referenced by com.cloudera.impala.analysis.CollectionStructType.CollectionStructType(), com.cloudera.impala.analysis.CollectionStructType.createArrayStructType(), com.cloudera.impala.analysis.SelectStmt.expandStar(), com.cloudera.impala.analysis.AnalyzeStmtsTest.TestCollectionTableRefs(), com.cloudera.impala.analysis.ToSqlTest.TestCollectionTableRefs(), and com.cloudera.impala.analysis.AnalyzeStmtsTest.TestImplicitAndExplicitPaths().
|
static |
|
private |
Definition at line 110 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.getFirstCollectionName(), com.cloudera.impala.analysis.Path.hasNonDestCollection(), com.cloudera.impala.analysis.Path.Path(), and com.cloudera.impala.analysis.Path.resolve().
|
private |
Definition at line 111 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.getFirstCollectionType(), com.cloudera.impala.analysis.Path.Path(), and com.cloudera.impala.analysis.Path.resolve().
|
private |
Definition at line 114 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.destColumn(), com.cloudera.impala.analysis.Path.destTable(), com.cloudera.impala.analysis.Path.destTupleDesc(), com.cloudera.impala.analysis.Path.destType(), com.cloudera.impala.analysis.Path.getAbsolutePath(), com.cloudera.impala.analysis.Path.getFirstCollectionName(), com.cloudera.impala.analysis.Path.getFirstCollectionType(), com.cloudera.impala.analysis.Path.getMatchedPositions(), com.cloudera.impala.analysis.Path.getMatchedTypes(), com.cloudera.impala.analysis.Path.hasNonDestCollection(), com.cloudera.impala.analysis.Path.isResolved(), and com.cloudera.impala.analysis.Path.resolve().
|
static |
Definition at line 78 of file Path.java.
Referenced by com.cloudera.impala.analysis.CollectionStructType.createMapStructType(), com.cloudera.impala.analysis.SelectStmt.expandStar(), com.cloudera.impala.analysis.AnalyzeStmtsTest.TestCollectionTableRefs(), com.cloudera.impala.analysis.ToSqlTest.TestCollectionTableRefs(), and com.cloudera.impala.analysis.AnalyzeStmtsTest.TestImplicitAndExplicitPaths().
|
static |
Definition at line 79 of file Path.java.
Referenced by com.cloudera.impala.analysis.CollectionStructType.CollectionStructType(), com.cloudera.impala.analysis.CollectionStructType.createMapStructType(), com.cloudera.impala.analysis.SelectStmt.expandStar(), com.cloudera.impala.analysis.AnalyzeStmtsTest.TestCollectionTableRefs(), and com.cloudera.impala.analysis.ToSqlTest.TestCollectionTableRefs().
|
private |
Definition at line 106 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.getAbsolutePath(), com.cloudera.impala.analysis.Path.getMatchedPositions(), and com.cloudera.impala.analysis.Path.resolve().
|
private |
Definition at line 105 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.destTable(), com.cloudera.impala.analysis.Path.destTupleDesc(), com.cloudera.impala.analysis.Path.destType(), and com.cloudera.impala.analysis.Path.getMatchedTypes().
|
private |
Definition at line 89 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.destColumn(), com.cloudera.impala.analysis.Path.getFullyQualifiedRawPath(), com.cloudera.impala.analysis.Path.getRawPath(), com.cloudera.impala.analysis.Path.Path(), com.cloudera.impala.analysis.Path.resolve(), and com.cloudera.impala.analysis.Path.toString().
|
private |
Definition at line 93 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.destTable(), com.cloudera.impala.analysis.Path.destTupleDesc(), com.cloudera.impala.analysis.Path.destType(), com.cloudera.impala.analysis.Path.getAbsolutePath(), com.cloudera.impala.analysis.Path.getFullyQualifiedRawPath(), com.cloudera.impala.analysis.Path.getRootDesc(), com.cloudera.impala.analysis.Path.Path(), com.cloudera.impala.analysis.Path.resolve(), and com.cloudera.impala.analysis.Path.toString().
|
private |
Definition at line 101 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.Path(), and com.cloudera.impala.analysis.Path.resolve().
|
private |
Definition at line 98 of file Path.java.
Referenced by com.cloudera.impala.analysis.Path.destColumn(), com.cloudera.impala.analysis.Path.destTable(), com.cloudera.impala.analysis.Path.destType(), com.cloudera.impala.analysis.Path.getFullyQualifiedRawPath(), com.cloudera.impala.analysis.Path.getRootTable(), com.cloudera.impala.analysis.Path.Path(), com.cloudera.impala.analysis.Path.resolve(), and com.cloudera.impala.analysis.Path.toString().