Implemention of aggregate funtion SUM

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
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Implemention of aggregate funtion SUM

Post by ksv2584 »

Hi All

I need to sum the amounts(100,200,-300 etc) based on code(abc,def,gkt etc) key column,but i want this implementation to be done without using aggration stage

Since using aggration stage,we cannot carry fwd remaining columns for further transformation. Though we can do self join after aggragation key columns are different in this scenario

Please suggest to sloution to this

Thanks
Vidya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use the Aggregator stage, perhaps in a fork-join model as you indicate. It will work, and it's the easiest mechanism.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Implemention of aggregate funtion SUM

Post by ksv2584 »

Hi ray,

I just want to clarify one more thing,intially iam doing the lookup b/w source file and lookup file with 5 key cloumns.

But for aggregation ,i just use one key column of the 5 key cloumns,so doing a fork join based on just one key , will this affect my logic flow

Can i perform this without losing any data,if yes i can do a leftouter join making the aggregator output link as right

please clarify above issue

Lots of thanks
Vidya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You won't lose any data. Only pass the columns to be grouped or summed to the Aggregator stage - pass all the others along the other link to the Join stage. All will be well, and you should not need an outer join - after all, the grouping keys came from the same data source!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Post by ksv2584 »

Hi Ray

Thanks for the early reply .. :)

one last clarification .. :?:

The key cloumn now i have for fork join is country code (ind,aus,nep) coming from aggrator output ,which will have duplicate values,so please can you let me know which type of join i need to perform (inner,left)

iam also placing a filter after aggregator based aggragete sum,before join,will this have any effect
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Inner will be fine. There won't be duplicate values out of the aggregator (because this was the grouping column) but there will be duplicates in the stream data. That's OK, that's what a join does.

As to your Filter question, that may cause an issue if you're doing an inner join - depends really on what the Filter is doing. You provided no information about that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ksv2584
Participant
Posts: 16
Joined: Wed Nov 10, 2010 6:10 am

Implemention of aggregate funtion SUM

Post by ksv2584 »

Thanks Ray ..

Implemented working fn .. 8)
Post Reply