MCPcopy Create free account
hub / github.com/apache/impala / View

Class View

fe/src/main/java/org/apache/impala/catalog/View.java:47–206  ·  view source on GitHub ↗

Table metadata representing a catalog view or a local view from a WITH clause. Most methods inherited from Table are not supposed to be called on this class because views are substituted with their underlying definition during analysis of a statement. Refreshing or invalidating a view will reload t

Source from the content-addressed store, hash-verified

45 * affect the metadata of the underlying tables (if any).
46 */
47public class View extends Table implements FeView {
48
49 // View definition created by parsing inlineViewDef_ into a QueryStmt.
50 private QueryStmt queryStmt_;
51
52 // Set if this View is from a WITH clause and not persisted in the catalog.
53 private final boolean isLocalView_;
54
55 // Set if this View is from a WITH clause with column labels.
56 private List<String> colLabels_;
57
58 public View(org.apache.hadoop.hive.metastore.api.Table msTable,
59 Db db, String name, String owner) {
60 super(msTable, db, name, owner);
61 isLocalView_ = false;
62 }
63
64 /**
65 * C'tor for WITH-clause views that already have a parsed QueryStmt and an optional
66 * list of column labels.
67 */
68 public View(String alias, QueryStmt queryStmt, List<String> colLabels) {
69 super(null, null, alias, null);
70 isLocalView_ = true;
71 queryStmt_ = queryStmt;
72 colLabels_ = colLabels;
73 }
74
75 /**
76 * Creates a view for testing purposes.
77 */
78 private View(Db db, String name, QueryStmt queryStmt) {
79 super(null, db, name, null);
80 isLocalView_ = false;
81 queryStmt_ = queryStmt;
82 colLabels_ = null;
83 }
84
85 @Override
86 public void load(boolean reuseMetadata, IMetaStoreClient client,
87 org.apache.hadoop.hive.metastore.api.Table msTbl, String reason,
88 EventSequence catalogTimeline) throws TableLoadingException {
89 try {
90 Table.LOADING_TABLES.incrementAndGet();
91 clearColumns();
92 msTable_ = msTbl;
93 // Load columns.
94 List<FieldSchema> fieldSchemas = client.getFields(db_.getName(), name_);
95 for (int i = 0; i < fieldSchemas.size(); ++i) {
96 FieldSchema s = fieldSchemas.get(i);
97 Type type = parseColumnType(s);
98 Column col = new Column(s.getName(), type, s.getComment(), i);
99 addColumn(col);
100 }
101 // These fields are irrelevant for views.
102 numClusteringCols_ = 0;
103 tableStats_ = new TTableStats(-1);
104 tableStats_.setTotal_file_bytes(-1);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected