storm-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jackson, Aubrey" <aubrey.jack...@here.com>
Subject Fields Grouping Calculation
Date Mon, 10 Oct 2016 15:36:02 GMT
Hello,

I’ve tried to use the information below to generate the hash, mod it, and in turn calculate
the correct consuming destination task index, but without success. I’ve scoured the Internet
where someone as an example of a hand calculation of this nature and have turned up empty.
I must be missing something in my hand calc, so I’m hoping someone on the list can help
me out.

I have field grouped as follows:

.fieldsGrouping(EXAMPLE_BOLT, EXAMPLE_BOLT_STREAM, new Fields(TopologyConstants.EXAMPLE_FIELD_GROUPING_ID))

My EXAMPLE_BOLT emits as shown here:

collector.emit(TopologyConstants.EXAMPLE_BOLT_STREAM, new Values(EXAMPLE_FIELD_GROUPING_ID_VALUE,
EXAMPLE_DATA_INSTANCE));

I preform the calculation as follows:

int numberOfConsumingTasks = x;
Integer EXAMPLE_FIELD_GROUPING_ID_VALUE = y;

ArrayList<Object> alist = new ArrayList<>();

alist.add(EXAMPLE_FIELD_GROUPING_ID_VALUE);

int hashCode = Arrays.deepHashCode(alist.toArray());

int targetTaskIndex = Math.abs(hashCode) % numberOfConsumingTasks;

The resulting targetTaskIndex value from this calculation does not match the value produced
by Storm.

Can someone tell me what I’m doing wrong?

Thanks,


Aubrey
Mime
View raw message