[
https://issues.apache.org/jira/browse/TAJO-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14077382#comment-14077382
]
Hyunsik Choi commented on TAJO-976:
-----------------------------------
The build failure was caused Long.compare() which was added since JDK 1.7. I'll
fix it shortly.
{code}
Long.compare(o1.getQuerySubmitTime(), o2.getQuerySubmitTime());
{code}
> HashPartitioner doesn't make desired number of partitions infrequently.
> -----------------------------------------------------------------------
>
> Key: TAJO-976
> URL: https://issues.apache.org/jira/browse/TAJO-976
> Project: Tajo
> Issue Type: Improvement
> Reporter: Hyoungjun Kim
> Assignee: Hyoungjun Kim
> Priority: Minor
>
> If the number desired partition is a multiples of 31, HashPartitioner doesn't
> make desired number of partitions. I tested with the following code.
> {code}
> Random rand = new Random();
> String[][] data = new String[1000][];
> for (int i = 0; i < 1000; i++) {
> data[i] = new String[]{ String.valueOf(rand.nextInt(1000)),
> String.valueOf(rand.nextInt(1000)), String.valueOf(rand.nextInt(1000))};
> }
> int[] testNumPartitions = new int[]{31, 62, 124, 32, 63, 125};
> for (int index = 0; index < testNumPartitions.length; index++) {
> Set<Integer> ids = new TreeSet<Integer>();
> for (int i = 0; i < data.length; i++) {
> VTuple vtuple = new VTuple(new Datum[]{new TextDatum(data[i][0]), new
> TextDatum(data[i][1]), new TextDatum(data[i][2])});
> int hashValue = vtuple.hashCode();
> int partitionId = (hashValue & Integer.MAX_VALUE) %
> testNumPartitions[index];
> ids.add(partitionId);
> }
> System.out.println("Expected partition num: " + testNumPartitions[index] +
> ", real partition num:" + ids.size());
> }
> {code}
> {noformat}
> Expected partition num: 31, real partition num:10
> Expected partition num: 62, real partition num:20
> Expected partition num: 124, real partition num:40
> Expected partition num: 32, real partition num:32
> Expected partition num: 63, real partition num:63
> Expected partition num: 125, real partition num:125
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)