Search in sources :

Example 1 with HiveProcessingEntity

use of org.apache.gobblin.data.management.conversion.hive.entities.HiveProcessingEntity in project incubator-gobblin by apache.

the class HiveMaterializerFromEntityQueryGenerator method getConversionEntity.

private HiveProcessingEntity getConversionEntity(HiveWorkUnit hiveWorkUnit) throws IOException, TException, HiveException {
    try (AutoReturnableObject<IMetaStoreClient> client = this.pool.getClient()) {
        HiveDataset dataset = hiveWorkUnit.getHiveDataset();
        HiveDatasetFinder.DbAndTable dbAndTable = dataset.getDbAndTable();
        Table table = new Table(client.get().getTable(dbAndTable.getDb(), dbAndTable.getTable()));
        Partition partition = null;
        if (hiveWorkUnit.getPartitionName().isPresent()) {
            partition = new Partition(table, client.get().getPartition(dbAndTable.getDb(), dbAndTable.getTable(), hiveWorkUnit.getPartitionName().get()));
        }
        return new HiveProcessingEntity(dataset, table, Optional.fromNullable(partition));
    }
}
Also used : Partition(org.apache.hadoop.hive.ql.metadata.Partition) Table(org.apache.hadoop.hive.ql.metadata.Table) HiveProcessingEntity(org.apache.gobblin.data.management.conversion.hive.entities.HiveProcessingEntity) HiveDatasetFinder(org.apache.gobblin.data.management.copy.hive.HiveDatasetFinder) HiveDataset(org.apache.gobblin.data.management.copy.hive.HiveDataset) IMetaStoreClient(org.apache.hadoop.hive.metastore.IMetaStoreClient)

Aggregations

HiveProcessingEntity (org.apache.gobblin.data.management.conversion.hive.entities.HiveProcessingEntity)1 HiveDataset (org.apache.gobblin.data.management.copy.hive.HiveDataset)1 HiveDatasetFinder (org.apache.gobblin.data.management.copy.hive.HiveDatasetFinder)1 IMetaStoreClient (org.apache.hadoop.hive.metastore.IMetaStoreClient)1 Partition (org.apache.hadoop.hive.ql.metadata.Partition)1 Table (org.apache.hadoop.hive.ql.metadata.Table)1