[
https://issues.apache.org/jira/browse/TAJO-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14077343#comment-14077343
]
ASF GitHub Bot commented on TAJO-976:
-------------------------------------
Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/94#discussion_r15504529
--- Diff:
tajo-core/src/test/resources/results/TestGroupByQuery/testHavingWithNamedTarget.result
---
@@ -1,5 +1,5 @@
l_orderkey,total,num
-------------------------------
3,2.5,3
-1,1.0,3
-2,2.0,1
\ No newline at end of file
+2,2.0,1
--- End diff --
This seems to be a non-deterministic query. I added order-by clause before
committing it.
> 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)