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

Method fromThrift

fe/src/main/java/org/apache/impala/catalog/Table.java:585–622  ·  view source on GitHub ↗

Factory method that creates a new Table from its Thrift representation. Determines the type of table to create based on the Thrift table provided.

(Db parentDb, TTable thriftTable, boolean loadedInImpalad)

Source from the content-addressed store, hash-verified

583 * Determines the type of table to create based on the Thrift table provided.
584 */
585 public static Table fromThrift(Db parentDb, TTable thriftTable, boolean loadedInImpalad)
586 throws TableLoadingException {
587 CatalogInterners.internFieldsInPlace(thriftTable);
588 Table newTable;
589 if (!thriftTable.isSetLoad_status() && thriftTable.isSetMetastore_table()) {
590 newTable = Table.fromMetastoreTable(parentDb, thriftTable.getMetastore_table());
591 } else {
592 TImpalaTableType tblType;
593 if (thriftTable.getTable_type() == TTableType.VIEW) {
594 tblType = TImpalaTableType.VIEW;
595 } else if (thriftTable.getTable_type() == TTableType.MATERIALIZED_VIEW) {
596 tblType = TImpalaTableType.MATERIALIZED_VIEW;
597 } else {
598 // If the table is unloaded or --pull_table_types_and_comments flag is not set,
599 // keep the legacy behavior as showing the table type as TABLE.
600 tblType = TImpalaTableType.TABLE;
601 }
602 // Use -1 as 'createEventId' since this is either in coordinator where no HMS events
603 // are being processed or imported from a COPY TESTCASE statement which shouldn't be
604 // used in production (it's used to examine metadata in dev env).
605 newTable =
606 IncompleteTable.createUninitializedTable(parentDb, thriftTable.getTbl_name(),
607 tblType, MetadataOp.getTableComment(thriftTable.getMetastore_table()),
608 /*createEventId*/-1);
609 }
610 newTable.storedInImpaladCatalogCache_ = loadedInImpalad;
611 try {
612 newTable.loadFromThrift(thriftTable);
613 } catch (IcebergTableLoadingException e) {
614 LOG.warn(String.format("The table %s in database %s could not be loaded.",
615 thriftTable.getTbl_name(), parentDb.getName()),
616 e);
617 newTable = IncompleteTable.createFailedMetadataLoadTable(
618 parentDb, thriftTable.getTbl_name(), e);
619 }
620 newTable.validate();
621 return newTable;
622 }
623
624 @Override // FeTable
625 public boolean isClusteringColumn(Column c) {

Callers 6

TestPartitionedTableMethod · 0.95
TestHBaseTablesMethod · 0.95
copyTestCaseDataMethod · 0.95
addTableMethod · 0.95

Calls 10

internFieldsInPlaceMethod · 0.95
fromMetastoreTableMethod · 0.95
getTableCommentMethod · 0.95
loadFromThriftMethod · 0.95
validateMethod · 0.95
warnMethod · 0.80
getNameMethod · 0.65
formatMethod · 0.45