Sum of Nulls- 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
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Sum of Nulls- Aggregator

Post by wahi80 »

Hi,

I have a job as follows

InDataset-->Aggregator---> OutDataset

The InDataset has three fields a,b,c. In the aggregator the group by is on a,b and summation of c. C can have values, Null,0,+ve or -ve numbers.

The problems is that all sum of nulls is converted to 0 in OutDataset. Hence I cannot figure out if the 0 is due to nulls or due to summation.

In Oracle a sum of nulls returns null, but not in DS.

Any way how to figure this out?

Regards
Ankur
csri
Participant
Posts: 99
Joined: Wed Jul 11, 2007 8:02 am

Post by csri »

In oracle also you will get column c sum as null only if all the records have null values. Anyways, one way to try this is have an additional field derived based on the value of column c. Lets say column d. Set the column d with NULVALUE if null or NOTNULVALUE is not null or ZEROVALUE if zero and passit through the aggregrator. Now you have to group by a,b,d and sum c.

Hope this help. Let me know if this works.
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

The output of Aggregator stage is always of double data type and as per my knowledge there is no concept of null in Double data Type .so you will never get Null as output.. Just to help your requirement ..Change the Null to some diffrent character before sending it to aggregator stage and then proceed..
ambasta
Post Reply