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

Method getPartialInfo

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

Return partial info about this table. This is called only on the catalogd to service GetPartialCatalogObject RPCs.

(
      TGetPartialCatalogObjectRequest req)

Source from the content-addressed store, hash-verified

814 * service GetPartialCatalogObject RPCs.
815 */
816 public TGetPartialCatalogObjectResponse getPartialInfo(
817 TGetPartialCatalogObjectRequest req) throws CatalogException {
818 Preconditions.checkState(isLoaded(), "unloaded table: %s", getFullName());
819 TTableInfoSelector selector = Preconditions.checkNotNull(req.table_info_selector,
820 "no table_info_selector");
821
822 TGetPartialCatalogObjectResponse resp = new TGetPartialCatalogObjectResponse();
823 resp.setObject_version_number(getCatalogVersion());
824 resp.setObject_loaded_time_ms(getLastLoadedTimeMs());
825 resp.table_info = new TPartialTableInfo();
826 resp.table_info.setStorage_metadata_load_time_ns(storageMetadataLoadTime_);
827 storageMetadataLoadTime_ = 0;
828 if (selector.want_hms_table) {
829 // TODO(todd): the deep copy could be a bit expensive. Unfortunately if we took
830 // a reference to this object, and let it escape out of the lock, it would be
831 // racy since the TTable is modified in place by some DDLs (eg 'dropTableStats').
832 // We either need to ensure that TTable is cloned on every write, or we need to
833 // ensure that serialization of the GetPartialCatalogObjectResponse object
834 // is done while we continue to hold the table lock.
835 resp.table_info.setHms_table(getMetaStoreTable().deepCopy());
836 resp.table_info.setVirtual_columns(new ArrayList<>());
837 for (VirtualColumn vCol : getVirtualColumns()) {
838 resp.table_info.addToVirtual_columns(vCol.toThrift());
839 }
840 }
841 if (selector.want_stats_for_column_names != null ||
842 selector.want_stats_for_all_columns) {
843 List<String> colList = selector.want_stats_for_all_columns ? getColumnNames() :
844 selector.want_stats_for_column_names;
845 List<ColumnStatisticsObj> statsList =
846 Lists.newArrayListWithCapacity(colList.size());
847 for (String colName: colList) {
848 Column col = getColumn(colName);
849 if (col == null) continue;
850
851 // Don't return stats for HDFS partitioning columns, since these are computed
852 // by the coordinator based on the partition map itself. This makes the
853 // behavior consistent with the HMS stats-fetching APIs.
854 //
855 // NOTE: we _do_ have to return stats for HBase clustering columns, because
856 // those aren't simple value partitions.
857 if (this instanceof FeFsTable && isClusteringColumn(col)) continue;
858
859 ColumnStatisticsData tstats = col.getStats().toHmsCompatibleThrift(col.getType());
860 if (tstats == null) continue;
861 // TODO(todd): it seems like the column type is not used? maybe worth not
862 // setting it here to save serialization.
863 statsList.add(new ColumnStatisticsObj(colName, col.getType().toString(), tstats));
864 }
865 resp.table_info.setColumn_stats(statsList);
866 }
867 if (getMetaStoreTable() != null &&
868 AcidUtils.isTransactionalTable(getMetaStoreTable().getParameters())) {
869 Preconditions.checkState(getValidWriteIds() != null);
870 resp.table_info.setValid_write_ids(
871 MetastoreShim.convertToTValidWriteIdList(getValidWriteIds()));
872 }
873 return resp;

Callers 1

Calls 15

getFullNameMethod · 0.95
getMetaStoreTableMethod · 0.95
getVirtualColumnsMethod · 0.95
getColumnNamesMethod · 0.95
getColumnMethod · 0.95
isClusteringColumnMethod · 0.95
getStatsMethod · 0.95
getTypeMethod · 0.95
isTransactionalTableMethod · 0.95
getValidWriteIdsMethod · 0.95
toHmsCompatibleThriftMethod · 0.80
isLoadedMethod · 0.65

Tested by

no test coverage detected