Skip to content

Commit

Permalink
Simplify partition sorting in HiveClient
Browse files Browse the repository at this point in the history
  • Loading branch information
dain committed Sep 26, 2014
1 parent 8fc7609 commit f60f411
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
import com.google.inject.Inject;
Expand All @@ -86,7 +85,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand All @@ -110,6 +108,7 @@
import static com.facebook.presto.hive.HiveUtil.encodeViewData;
import static com.facebook.presto.hive.HiveUtil.getTableStructFields;
import static com.facebook.presto.hive.HiveUtil.parseHiveTimestamp;
import static com.facebook.presto.hive.HiveUtil.partitionIdGetter;
import static com.facebook.presto.hive.UnpartitionedPartition.UNPARTITIONED_PARTITION;
import static com.facebook.presto.hive.util.Types.checkType;
import static com.facebook.presto.spi.StandardErrorCode.PERMISSION_DENIED;
Expand Down Expand Up @@ -995,8 +994,8 @@ public ConnectorSplitSource getPartitionSplits(ConnectorTableHandle tableHandle,
SchemaTableName tableName = hivePartition.getTableName();
Optional<HiveBucket> bucket = hivePartition.getBucket();

List<String> partitionNames = new ArrayList<>(Lists.transform(partitions, HiveUtil.partitionIdGetter()));
Collections.sort(partitionNames, Ordering.natural().reverse());
// sort partitions by name
List<String> partitionNames = Ordering.natural().reverse().sortedCopy(transform(partitions, partitionIdGetter()));

Table table;
Iterable<Partition> hivePartitions;
Expand Down

0 comments on commit f60f411

Please sign in to comment.