org.apache.hadoop.hive.ql.metadata.Table.getTTable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中org.apache.hadoop.hive.ql.metadata.Table.getTTable()方法的一些代码示例,展示了Table.getTTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getTTable()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Table
类名称:Table
方法名:getTTable

Table.getTTable介绍

[英]This function should only be used in serialization. We should never call this function to modify the fields, because the cached fields will become outdated.
[中]此函数只能用于序列化。我们不应该调用此函数来修改字段,因为缓存的字段将过时。

代码示例

代码示例来源:origin: apache/hive

  1. /**
  2. * Should produce the same result as
  3. * {@link org.apache.hadoop.hive.metastore.txn.TxnUtils#isAcidTable(org.apache.hadoop.hive.metastore.api.Table)}
  4. */
  5. public static boolean isFullAcidTable(Table table) {
  6. return isFullAcidTable(table == null ? null : table.getTTable());
  7. }

代码示例来源:origin: apache/hive

  1. private org.apache.hadoop.hive.metastore.api.Table getTempTable(String dbName, String tableName) {
  2. Map<String, Table> tables = getTempTablesForDatabase(dbName.toLowerCase(),
  3. tableName.toLowerCase());
  4. if (tables != null) {
  5. Table table = tables.get(tableName.toLowerCase());
  6. if (table != null) {
  7. return table.getTTable();
  8. }
  9. }
  10. return null;
  11. }

代码示例来源:origin: apache/hive

  1. @Override
  2. public StorageDescriptor getPartSd() {
  3. return table.getTTable().getSd();
  4. }

代码示例来源:origin: apache/hive

  1. @Override
  2. public Map<String, String> getPartParameters() {
  3. return table.getTTable().getParameters();
  4. }

代码示例来源:origin: apache/hive

  1. public Properties getMetadataFromPartitionSchema() {
  2. return MetaStoreUtils.getPartitionMetadata(tPartition, table.getTTable());
  3. }

代码示例来源:origin: apache/incubator-gobblin

  1. @Override
  2. public long getUpdateTime(Table table) throws UpdateNotFoundException {
  3. // TODO if a table/partition is registered by gobblin an update time will be made available in table properties
  4. // Use the update time instead of create time
  5. return TimeUnit.MILLISECONDS.convert(table.getTTable().getCreateTime(), TimeUnit.SECONDS);
  6. }

代码示例来源:origin: apache/hive

  1. @Nullable
  2. public StorageHandlerInfo getStorageHandlerInfo(Table table)
  3. throws HiveException {
  4. try {
  5. HiveStorageHandler storageHandler = createStorageHandler(table.getTTable());
  6. return storageHandler == null ? null : storageHandler.getStorageHandlerInfo(table.getTTable());
  7. } catch (Exception e) {
  8. throw new HiveException(e);
  9. }
  10. }
  11. }

代码示例来源:origin: apache/hive

  1. final public Deserializer getDeserializer() {
  2. if (deserializer == null) {
  3. try {
  4. deserializer = HiveMetaStoreUtils.getDeserializer(SessionState.getSessionConf(),
  5. tPartition, table.getTTable());
  6. } catch (MetaException e) {
  7. throw new RuntimeException(e);
  8. }
  9. }
  10. return deserializer;
  11. }

代码示例来源:origin: apache/hive

  1. /**
  2. * Are the basic stats for the table up-to-date for query planning.
  3. * Can run additional checks compared to the version in StatsSetupConst.
  4. */
  5. public static boolean areBasicStatsUptoDateForQueryAnswering(Table table, Map<String, String> params) {
  6. // HIVE-19332: external tables should not be considered to have up-to-date stats.
  7. if (MetaStoreUtils.isExternalTable(table.getTTable())) {
  8. return false;
  9. }
  10. return StatsSetupConst.areBasicStatsUptoDate(params);
  11. }

代码示例来源:origin: apache/hive

  1. /**
  2. * Are the column stats for the table up-to-date for query planning.
  3. * Can run additional checks compared to the version in StatsSetupConst.
  4. */
  5. public static boolean areColumnStatsUptoDateForQueryAnswering(Table table, Map<String, String> params, String colName) {
  6. // HIVE-19332: external tables should not be considered to have up-to-date stats.
  7. if (MetaStoreUtils.isExternalTable(table.getTTable())) {
  8. return false;
  9. }
  10. return StatsSetupConst.areColumnStatsUptoDate(params, colName);
  11. }

代码示例来源:origin: apache/hive

  1. public TruncateTableDesc(String tableName, Map<String, String> partSpec,
  2. ReplicationSpec replicationSpec, Table table) {
  3. this.tableName = tableName;
  4. this.partSpec = partSpec;
  5. this.replicationSpec = replicationSpec;
  6. this.isTransactional = AcidUtils.isTransactionalTable(table);
  7. this.fullTableName = table == null ? tableName : Warehouse.getQualifiedName(table.getTTable());
  8. }

代码示例来源:origin: apache/hive

  1. public Path getDataLocation() {
  2. if (table.isPartitioned()) {
  3. if (tPartition.getSd() == null)
  4. return null;
  5. else
  6. return new Path(tPartition.getSd().getLocation());
  7. } else {
  8. if (table.getTTable() == null || table.getTTable().getSd() == null)
  9. return null;
  10. else
  11. return new Path(table.getTTable().getSd().getLocation());
  12. }
  13. }

代码示例来源:origin: apache/hive

  1. public static String getTableInformation(Table table, boolean isOutputPadded) {
  2. StringBuilder tableInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
  3. // Table Metadata
  4. tableInfo.append(LINE_DELIM).append("# Detailed Table Information").append(LINE_DELIM);
  5. getTableMetaDataInformation(tableInfo, table, isOutputPadded);
  6. // Storage information.
  7. tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
  8. getStorageDescriptorInfo(tableInfo, table.getTTable().getSd());
  9. if (table.isView() || table.isMaterializedView()) {
  10. tableInfo.append(LINE_DELIM).append(table.isView() ? "# View Information" : "# Materialized View Information").append(LINE_DELIM);
  11. getViewInfo(tableInfo, table);
  12. }
  13. return tableInfo.toString();
  14. }

代码示例来源:origin: apache/hive

  1. @Override
  2. public Object getOutput() throws HiveException {
  3. return new Table(getTable().getTTable());
  4. }

代码示例来源:origin: apache/hive

  1. protected Table getDummyTable() throws SemanticException {
  2. Path dummyPath = createDummyFile();
  3. Table desc = new Table(DUMMY_DATABASE, DUMMY_TABLE);
  4. desc.getTTable().getSd().setLocation(dummyPath.toString());
  5. desc.getTTable().getSd().getSerdeInfo().setSerializationLib(NullStructSerDe.class.getName());
  6. desc.setInputFormatClass(NullRowsInputFormat.class);
  7. desc.setOutputFormatClass(HiveIgnoreKeyTextOutputFormat.class);
  8. return desc;
  9. }

代码示例来源:origin: apache/incubator-gobblin

  1. /**
  2. * Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive table
  3. * @param targetTable, new Table to be registered in hive
  4. * @throws IOException
  5. */
  6. public static void updateTableAttributesIfAvro(Table targetTable, HiveCopyEntityHelper hiveHelper) throws IOException {
  7. if (isHiveTableAvroType(targetTable)) {
  8. updateAvroSchemaURL(targetTable.getCompleteName(), targetTable.getTTable().getSd(), hiveHelper);
  9. }
  10. }

代码示例来源:origin: apache/hive

  1. private static boolean hasExternalTableAncestor(Operator op, StringBuilder sb) {
  2. boolean result = false;
  3. Operator ancestor = OperatorUtils.findSingleOperatorUpstream(op, TableScanOperator.class);
  4. if (ancestor != null) {
  5. TableScanOperator ts = (TableScanOperator) ancestor;
  6. if (MetaStoreUtils.isExternalTable(ts.getConf().getTableMetadata().getTTable())) {
  7. sb.append(ts.getConf().getTableMetadata().getFullyQualifiedName());
  8. return true;
  9. }
  10. }
  11. return result;
  12. }
  13. }

代码示例来源:origin: apache/hive

  1. /**
  2. * create an empty partition.
  3. * SemanticAnalyzer code requires that an empty partition when the table is not partitioned.
  4. */
  5. public Partition(Table tbl) throws HiveException {
  6. org.apache.hadoop.hive.metastore.api.Partition tPart =
  7. new org.apache.hadoop.hive.metastore.api.Partition();
  8. if (!tbl.isView()) {
  9. tPart.setSd(tbl.getTTable().getSd().deepCopy());
  10. }
  11. initialize(tbl, tPart);
  12. }

代码示例来源:origin: apache/hive

  1. private int preInsertWork(Hive db, PreInsertTableDesc preInsertTableDesc) throws HiveException {
  2. try{
  3. HiveMetaHook hook = preInsertTableDesc.getTable().getStorageHandler().getMetaHook();
  4. if (hook == null || !(hook instanceof DefaultHiveMetaHook)) {
  5. return 0;
  6. }
  7. DefaultHiveMetaHook hiveMetaHook = (DefaultHiveMetaHook) hook;
  8. hiveMetaHook.preInsertTable(preInsertTableDesc.getTable().getTTable(), preInsertTableDesc.isOverwrite());
  9. } catch (MetaException e) {
  10. throw new HiveException(e);
  11. }
  12. return 0;
  13. }

代码示例来源:origin: apache/incubator-gobblin

  1. private static Partition localTestPartition(Table table, List<String> values) throws Exception {
  2. return new Partition(table,
  3. LocalHiveMetastoreTestUtils.getInstance().addTestPartition(table.getTTable(), values, 0));
  4. }
  5. }

相关文章

Table类方法