You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "Jungtaek Lim (JIRA)" <ji...@apache.org> on 2018/02/18 00:07:00 UTC
[jira] [Resolved] (STORM-2950) ArrayIndexOutOfBoundsException in
FieldsGrouper.chooseTasks function
[ https://issues.apache.org/jira/browse/STORM-2950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jungtaek Lim resolved STORM-2950.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
Thanks [~ethanli], I merged into master.
> ArrayIndexOutOfBoundsException in FieldsGrouper.chooseTasks function
> --------------------------------------------------------------------
>
> Key: STORM-2950
> URL: https://issues.apache.org/jira/browse/STORM-2950
> Project: Apache Storm
> Issue Type: Bug
> Reporter: Ethan Li
> Assignee: Ethan Li
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.0.0
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> TupleUtils.chooseTaskIndex:
> {code:java}
> public static <T> int chooseTaskIndex(List<T> keys, int numTasks) {
> return Math.abs(listHashCode(keys)) % numTasks;
> }
> {code}
>
> listHashCode(keys) might return Integer.MIN_VALUE (-2147483648). Math.abs(-2147483648) equals to -2147483648.
> In this case, chooseTaskIndex might return negative numbers and it will cause ArrayIndexOutOfBoundsException in FieldsGrouper.chooseTasks
> {code:java}
> @Override
> public List<Integer> chooseTasks(int taskId, List<Object> values) {
> int targetTaskIndex = TupleUtils.chooseTaskIndex(outFields.select(groupFields, values), numTasks);
> return targetTasks.get(targetTaskIndex);
> }
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)