static String shouldTableBeExternal(Table tableObj, String ownerName, Configuration conf, IMetaStoreClient hms, Boolean isPathOwnedByHive) throws IOException, MetaException, TException { if (MetaStoreUtils.isNonNativeTable(tableObj)) { return "Table is a non-native (StorageHandler) table"; } if (HiveStrictManagedUtils.isAvroTableWithExternalSchema(tableObj)) { return "Table is an Avro table with an external schema url"; } // List bucketed table cannot be converted to transactional if (HiveStrictManagedUtils.isListBucketedTable(tableObj)) { return "Table is a list bucketed table"; } // If any table/partition directory is not owned by hive, // then assume table is using storage-based auth - set external. // Transactional tables should still remain transactional, // but we should have already checked for that before this point. if (isPathOwnedByHive != null) { // for replication flow, the path ownership must be verified at source cluster itself. return isPathOwnedByHive ? null : String.format("One or more table directories is not owned by hive or non-HDFS path at source cluster"); } else if (shouldTablePathBeExternal(tableObj, ownerName, conf, hms)) { return String.format("One or more table directories not owned by %s, or non-HDFS path", ownerName); } return null; }
if (MetaStoreUtils.isNonNativeTable(tableObj)) { String msg = createManagedConversionExcuse(tableObj, "Table is a non-native (StorageHandler) table");
tblPath = wh.getDefaultTablePath(db, tbl); } else { if (!isExternal(tbl) && !MetaStoreUtils.isNonNativeTable(tbl)) { LOG.warn("Location: " + tbl.getSd().getLocation() + " specified for non-external table:" + tbl.getTableName());
/** * Checks if the table is valid based on the rules for strict managed tables. * @param conf * @param table * @return Null if the table is valid, otherwise a string message indicating why the table is invalid. */ public static String validateStrictManagedTable(Configuration conf, Table table) { if (MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.STRICT_MANAGED_TABLES)) { if (table.isTemporary()) { // temp tables exempted from checks. return null; } TableType tableType = TableType.valueOf(table.getTableType()); if (tableType == TableType.MANAGED_TABLE) { if (!MetaStoreServerUtils.isTransactionalTable(table.getParameters())) { return createValidationError(table, "Table is marked as a managed table but is not transactional."); } if (MetaStoreUtils.isNonNativeTable(table)) { return createValidationError(table, "Table is marked as a managed table but is non-native."); } if (isAvroTableWithExternalSchema(table)) { return createValidationError(table, "Managed Avro table has externally defined schema."); } } } // Table is valid return null; }
return null; if (MetaStoreUtils.isNonNativeTable(tbl.getTTable())) { Logger.info("Table " + tbl.getTableName() + " is non Native table. Skip StatsOptimizer."); return null;
if (AcidUtils.isTransactionalTable(t)) { compBuilder.setShared(); } else if (MetaStoreUtils.isNonNativeTable(t.getTTable())) { final HiveStorageHandler storageHandler = Preconditions.checkNotNull(t.getStorageHandler(), "Thought all the non native tables have an instance of storage handler");
tblPath = wh.getDefaultTablePath(db, tbl); } else { if (!isExternal(tbl) && !MetaStoreUtils.isNonNativeTable(tbl)) { LOG.warn("Location: " + tbl.getSd().getLocation() + " specified for non-external table:" + tbl.getTableName());