use of org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc in project hive by apache.
the class ReplLoadTask method createViewTask.
public static Task<?> createViewTask(MetaData metaData, String dbNameToLoadIn, HiveConf conf, String dumpDirectory, ReplicationMetricCollector metricCollector) throws SemanticException {
Table table = new Table(metaData.getTable());
String dbName = dbNameToLoadIn == null ? table.getDbName() : dbNameToLoadIn;
TableName tableName = HiveTableName.ofNullable(table.getTableName(), dbName);
String dbDotView = tableName.getNotEmptyDbTable();
String viewOriginalText = table.getViewOriginalText();
String viewExpandedText = table.getViewExpandedText();
if (!dbName.equals(table.getDbName())) {
// TODO: If the DB name doesn't match with the metadata from dump, then need to rewrite the original and expanded
// texts using new DB name. Currently it refers to the source database name.
}
CreateViewDesc desc = new CreateViewDesc(dbDotView, table.getCols(), null, table.getParameters(), table.getPartColNames(), false, false, viewOriginalText, viewExpandedText, table.getPartCols());
desc.setReplicationSpec(metaData.getReplicationSpec());
desc.setOwnerName(table.getOwner());
return TaskFactory.get(new DDLWork(new HashSet<>(), new HashSet<>(), desc, true, dumpDirectory, metricCollector), conf);
}
Aggregations