Search in sources :

Example 1 with HivePartitionItem

use of com.airbnb.airpal.presto.hive.HivePartition.HivePartitionItem in project airpal by airbnb.

the class TablesResource method getPartitionsWithMetaData.

private List<HivePartitionItem> getPartitionsWithMetaData(PartitionedTable table) throws ExecutionException {
    List<HivePartition> partitions = columnCache.getPartitions(table.getSchema(), table.getTable());
    ImmutableList.Builder<HivePartitionItem> partitionItems = ImmutableList.builder();
    for (HivePartition partition : partitions) {
        for (Object value : partition.getValues()) {
            PartitionedTable partitionedTable = table.withPartitionName(HivePartition.getPartitionId(partition.getName(), value));
            DateTime updatedAt = null;
            partitionItems.add(new HivePartitionItem(partition.getName(), partition.getType(), value, updatedAt));
        }
    }
    return partitionItems.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) PartitionedTable(com.airbnb.airpal.presto.PartitionedTable) HivePartitionItem(com.airbnb.airpal.presto.hive.HivePartition.HivePartitionItem) DateTime(org.joda.time.DateTime) HivePartition(com.airbnb.airpal.presto.hive.HivePartition)

Aggregations

PartitionedTable (com.airbnb.airpal.presto.PartitionedTable)1 HivePartition (com.airbnb.airpal.presto.hive.HivePartition)1 HivePartitionItem (com.airbnb.airpal.presto.hive.HivePartition.HivePartitionItem)1 ImmutableList (com.google.common.collect.ImmutableList)1 DateTime (org.joda.time.DateTime)1