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

Class VirtualTable

fe/src/main/java/org/apache/impala/catalog/VirtualTable.java:39–158  ·  view source on GitHub ↗

Tables that aren't actually exist in HMS. E.g. Iceberg position delete tables. Metadata tables can be another use case for this class. Using old table schema and stats during time-travel might be another use case.

Source from the content-addressed store, hash-verified

37 * Using old table schema and stats during time-travel might be another use case.
38 */
39public abstract class VirtualTable implements FeTable {
40 protected final Table msTable_;
41 protected final FeDb db_;
42 protected final String name_;
43 protected final String owner_;
44
45 // colsByPos[i] refers to the ith column in the table. The first numClusteringCols are
46 // the clustering columns.
47 protected final List<Column> colsByPos_ = new ArrayList<>();
48
49 // map from lowercase column name to Column object.
50 protected final Map<String, Column> colsByName_ = new HashMap<>();
51
52 // Number of clustering columns.
53 protected int numClusteringCols_ = 0;
54
55 // Type of this table (array of struct) that mirrors the columns. Useful for analysis.
56 protected final ArrayType type_ = new ArrayType(new StructType());
57
58 public VirtualTable(org.apache.hadoop.hive.metastore.api.Table msTable, FeDb db,
59 String name, String owner) {
60 msTable_ = msTable;
61 db_ = db;
62 name_ = name;
63 owner_ = owner;
64 }
65
66 protected void addColumn(Column col) {
67 colsByPos_.add(col);
68 colsByName_.put(col.getName().toLowerCase(), col);
69 ((StructType) type_.getItemType()).addField(
70 new StructField(col.getName(), col.getType(), col.getComment()));
71 }
72
73 @Override
74 public String getTableComment() { return null; }
75
76 @Override
77 public boolean isLoaded() { return true; }
78
79 @Override
80 public Table getMetaStoreTable() { return msTable_; }
81
82 @Override
83 public String getStorageHandlerClassName() { return null; }
84
85 @Override
86 public TCatalogObjectType getCatalogObjectType() { return TCatalogObjectType.TABLE; }
87
88 @Override
89 public TImpalaTableType getTableType() { return TImpalaTableType.TABLE; }
90
91 @Override
92 public FeDb getDb() { return db_; }
93
94 @Override
95 public String getName() { return name_; }
96

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected