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

Class LocalTable

fe/src/main/java/org/apache/impala/catalog/local/LocalTable.java:78–481  ·  view source on GitHub ↗

Table instance loaded from LocalCatalog. This class is not thread-safe. A new instance is created for each catalog instance.

Source from the content-addressed store, hash-verified

76 * each catalog instance.
77 */
78abstract class LocalTable implements FeTable {
79 private static final Logger LOG = LoggerFactory.getLogger(LocalTable.class);
80
81 protected final LocalDb db_;
82 /** The lower-case name of the table. */
83 protected final String name_;
84 protected final TImpalaTableType tableType_;
85 protected final String tableComment_;
86
87 private final ColumnMap cols_;
88
89 protected final Table msTable_;
90
91 private final TTableStats tableStats_;
92
93 // Virtual columns of this table.
94 protected final ArrayList<VirtualColumn> virtualCols_ = new ArrayList<>();
95
96 // Test only stats that will be injected in place of stats obtained from HMS.
97 protected SideloadTableStats testStats_ = null;
98
99 // Scale factor to multiply table stats with. Only used for testing.
100 protected double testMetadataScale_ = 1.0;
101
102 /**
103 * Table reference as provided by the initial call to the metadata provider.
104 * This must be passed back to any further calls to the metadata provider
105 * in order to verify consistency.
106 *
107 * In the case of CTAS target tables, this may be null. Since the tables don't
108 * exist yet in any metadata storage, it would be invalid to try to load any metadata
109 * about them.
110 */
111 @Nullable
112 @VisibleForTesting
113 protected final TableMetaRef ref_;
114
115 public static LocalTable load(LocalDb db, String tblName) throws TableLoadingException {
116 Pair<Table, TableMetaRef> tableMeta = loadTableMetadata(db, tblName);
117 return load(db, tableMeta);
118 }
119
120 public static LocalTable load(LocalDb db, Pair<Table, TableMetaRef> tableMeta)
121 throws TableLoadingException {
122 // In order to know which kind of table subclass to instantiate, we need
123 // to eagerly grab and parse the top-level Table object from the HMS.
124 LocalTable t = null;
125 Table msTbl = tableMeta.first;
126 TableMetaRef ref = tableMeta.second;
127 if (TableType.valueOf(msTbl.getTableType()) == TableType.VIRTUAL_VIEW) {
128 t = new LocalView(db, msTbl, ref);
129 } else if (HBaseTable.isHBaseTable(msTbl)) {
130 t = LocalHbaseTable.loadFromHbase(db, msTbl, ref);
131 } else if (KuduTable.isKuduTable(msTbl)) {
132 t = LocalKuduTable.loadFromKudu(db, msTbl, ref);
133 } else if (IcebergTable.isIcebergTable(msTbl)) {
134 t = LocalIcebergTable.loadIcebergTableViaMetaProvider(db, msTbl, ref);
135 } else if (PaimonUtil.isPaimonTable(msTbl)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected