Wrong Results in Aggregator

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ppavani_km
Participant
Posts: 11
Joined: Mon Mar 17, 2008 3:14 pm

Wrong Results in Aggregator

Post by ppavani_km »

Hi,
In my input data i have amount coloumn as data type Decimal(15,2).
the amount may contain either +'ve or -'ve values.
When I am trying to sum up the amount coloumn using aggregator first it raised up warning saying precesion exceeding.
so that i have changed the data type from decimal to double before aggregator.then it is not showing up any warnings.
but on each time i run the job the aggregated amount coloumn is showing wrong results.
I even used Modify stage also before aggregator but still it is showing wrong resuts.
test data.
ID AMOUNT(15,2)
10 150.00
10 -100.00
10 -50.00
20 140
30 45
30 -45
so after aggregation it should come like this without any warnings.
ID AMOUNT(15,2)
10 0
20 140
30 0
Please help.
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post by OddJob »

What values did you actually receive?
ppavani_km
Participant
Posts: 11
Joined: Mon Mar 17, 2008 3:14 pm

RE:Wrong Results in Aggregator

Post by ppavani_km »

For each run i am getting different values like as follows
ID AMOUNT(15,2)
10 150
20 140
30 0
or
ID AMOUNT(15,2)
10 -150
20 140
30 -45

OddJob wrote:What values did you actually receive?
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post by OddJob »

Can you detail the sort and partitioning you're applying?
ppavani_km
Participant
Posts: 11
Joined: Mon Mar 17, 2008 3:14 pm

Post by ppavani_km »

I just took the auto option for ID coloumn.
MY problem is with the amount field lenth and data type.
OddJob wrote:Can you detail the sort and partitioning you're applying?
John Smith
Charter Member
Charter Member
Posts: 193
Joined: Tue Sep 05, 2006 8:01 pm
Location: Australia

Post by John Smith »

ppavani_km wrote:I just took the auto option for ID coloumn.
MY problem is with the amount field lenth and data type.
OddJob wrote:Can you detail the sort and partitioning you're applying?
Try partitioning your data by the ID column.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

use Hash partition and sorting on the the aggregate column (ID in this case)
yatin.mittal
Participant
Posts: 20
Joined: Fri Oct 14, 2005 12:52 am

Post by yatin.mittal »

You should have the data in sorted order on the primary set (on which you are aggregating) before applying the aggregate function. If its not in sorted form, then it can give wrong results.
Yatin Mittal
Accenture Services Pvt. Ltd.
ppavani_km
Participant
Posts: 11
Joined: Mon Mar 17, 2008 3:14 pm

Post by ppavani_km »

I tried doing Hash partitioning on ID coloumn still showing wrong results.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

can you try running this job in single node and see the result.
DS_FocusGroup
Premium Member
Premium Member
Posts: 197
Joined: Sun Jul 15, 2007 11:45 pm
Location: Prague

Post by DS_FocusGroup »

use a sort stage before the aggregator stage and hash partition on the keys which you are using for aggregation in the same order. also sort ascending in the same order. should work!
DS_FocusGroup
Premium Member
Premium Member
Posts: 197
Joined: Sun Jul 15, 2007 11:45 pm
Location: Prague

Post by DS_FocusGroup »

use a sort stage before the aggregator stage and hash partition on the keys which you are using for aggregation in the same order. also sort ascending in the same order. should work!
DS_FocusGroup
Premium Member
Premium Member
Posts: 197
Joined: Sun Jul 15, 2007 11:45 pm
Location: Prague

Post by DS_FocusGroup »

use a sort stage before the aggregator stage and hash partition on the keys which you are using for aggregation in the same order. also sort ascending in the same order. should work!
Post Reply