Parallel Transformer execution order

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
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Parallel Transformer execution order

Post by Developer9 »

I know this question is asked many many times , i see 2 answers 1. SV, Constraints, Derivations 2. Constraints , SV, Derivations. I tried for this in IBM documentation and couldn't find it anywhere.

I personally feel its SV, Const and Derivations for the reason why process all the SV's for all input records if the constraint drops a lot of records.

Please throw some light on this.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Considering that one can use stage variables in constraints, the order is first to evaluate the stage variables, then evaluate constraints and finally to evaluate derivations.
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Post by Developer9 »

ArndW, Thanks for the reply , This answer looks simple but is also why i debate with myself.

Considering the Stage variables can be used inside constraints , shouldn't the execution order be dynamic? first Check if a SV is used inside a constraint if yes then process SV before Constraints. And if not first process Constraints then SV. isn't it the better solution ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Going that route might save some processing cycles in jobs where a large majority of the rows are filtered by a constraint; but it would add complexity to the process of compiling transform stages plus it introduces potential confusion.
The Server transform stage would also need to be changed...

Thus I think that while an enhancement request might have merit, it won't be acted on by engineering because the potential gain [speed in certain cases] is outweighed by the risks [of breaking something].
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

As previous poster has said, order of evaluation is SV, Constraints, Derivations

Generated code from transformer stage in folder RT_SCn of project directory (where n is JobNo). You can see that order of evaluation over there.

See snippet below:

Code: Select all

mainloop {
        // declare our intermediate variables for this section
        dfloat InterVar0_0;
        dfloat InterVar0_1;
        // evaluate the stage variables first
        StageVar0_StageVar = in_dat.PART_NUM;
        // initialise the rejected row variable
        RowRejected0 = 1;
        // evaluate constraint and columns for link: out_dat
        if ((in_dat.COST_PRICE > in_dat.SALE_PRICE))
        {
                if ((in_dat.SALE_PRICE >= in_dat.COST_PRICE)) {
                        InterVar0_0 = 0.0;
                } else {
                        InterVar0_1 = in_dat.SALE_PRICE;
                        InterVar0_0 = InterVar0_1;
                }
                if ((InterVar0_0 > 0)) {
                        out_dat.CLEARENCE_IND_Corrected = InterVar0_2;
                } else {
                        out_dat.CLEARENCE_IND_Corrected = InterVar0_3;
                }
                //;
                writerecord 0;
                RowRejected0 = 0;
        }
}
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

1. Stage Variables top to bottom
2. Loop Variables top to bottom
3. Output links & Constraints top to bottom
4. Derivations top to bottom
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Also, you can see from the posted code that when a constraint evaluates to FALSE, the derivations in the link are not... derived.

Wanted to add that I'm not sure I'd want to see anything about the order it evaluates things be made 'dynamic'. For whatever that is worth.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Post by Developer9 »

Very useful information , Thanks to everyone.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

It is well documented, but a bit buried. I did not find it by searching "execution order" but by searching "stage variable" or "evaluation sequence."

Here is a link.
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hmm, nobody mentioned initialization of stage variables, initialization of loop variables or execution of loop variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... true about initializations but execution of loop variables was mentioned.
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

The IBM doc link given above details it quite well. :wink:
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's also logic to detect whether any otherwise/log and reject output links need to be used.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply