Search in sources :

Example 1 with Partition

use of org.apache.kudu.client.Partition in project presto by prestodb.

the class KuduTableProperties method getRangePartitionList.

private static List<RangePartition> getRangePartitionList(KuduTable table, long deadline) {
    List<RangePartition> rangePartitions = new ArrayList<>();
    if (!table.getPartitionSchema().getRangeSchema().getColumns().isEmpty()) {
        try {
            Iterator var4 = table.getTabletsLocations(deadline).iterator();
            while (var4.hasNext()) {
                LocatedTablet tablet = (LocatedTablet) var4.next();
                Partition partition = tablet.getPartition();
                if (Iterators.all(partition.getHashBuckets().iterator(), Predicates.equalTo(0))) {
                    RangePartition rangePartition = buildRangePartition(table, partition);
                    rangePartitions.add(rangePartition);
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    return rangePartitions;
}
Also used : Partition(org.apache.kudu.client.Partition) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) LocatedTablet(org.apache.kudu.client.LocatedTablet) PrestoException(com.facebook.presto.spi.PrestoException) IOException(java.io.IOException)

Aggregations

PrestoException (com.facebook.presto.spi.PrestoException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LocatedTablet (org.apache.kudu.client.LocatedTablet)1 Partition (org.apache.kudu.client.Partition)1