Page 1 of 1
Transformer Stage variable increment not working
Posted: Sun Nov 14, 2010 11:16 pm
by Nagalakshmi.Krishna
Hi,
In DS Transformer stage , I use one stage variable STGVAR1 of IINTEGER with starting value 0.And then I use the expression that STGVAR1+1.The values in the output not coming correctly,output I pasted below.Can you help me the reason why it is not incrementing properly?
1
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
12
13
14
.
.
.
Posted: Sun Nov 14, 2010 11:18 pm
by chulett
How many nodes is your job running on? More than one, it seems.
Posted: Sun Nov 14, 2010 11:47 pm
by Rakesh311
If there are more than one node then
Go to transformer Properties , then Advanced
And then change execution mode to sequential
:D
Re: Transformer Stage variable increment not working
Posted: Mon Nov 15, 2010 1:54 am
by ray.wurlod
Nagalakshmi.Krishna wrote:Can you help me the reason why it is not incrementing properly?
No, because both instances of your Transformer stage ARE incrementing correctly. You have two lots of 1 through 20. If you need to preserve the order thereof, add a sort of some kind downstream of the Transformer stage, and use a Sort Merge collection algorithm.
Posted: Mon Nov 15, 2010 5:17 am
by dxwwq557
beacause of the partition, the are two partitions in ur job, u should change the stage property, use sequencial.defualt by parallel.
Posted: Mon Nov 15, 2010 7:45 am
by chulett
Or understand why it is happening and deal with or adapt it as Ray notes, rather than force your parallel job to run sequential.
Posted: Mon Nov 15, 2010 9:04 am
by ArndW
Typically you would use an algorithm such as the following in a transform stage to ensure that you get a single unique number across any number of partitions in your job:
Code: Select all
(@NUMPARTITIONS * ( @INROWNUM - 1)) + @PARTITIONNUM
Posted: Sun Nov 21, 2010 12:24 am
by Ravi.K
Here Transformer runs in Parallel Mode. So, records are distributed accordingly to the nodes. To generate Sequence number use the below derivation.
(((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1)
Posted: Mon Nov 22, 2010 4:02 am
by naveen.p
Hi,
The Logic is not working correctly.
Its giving the Odd numbers in the Sequence.
Thanks
Naveen
Posted: Mon Nov 22, 2010 5:28 am
by ray.wurlod
It IS correct. The even numbers are on the other node.
Posted: Mon Nov 22, 2010 6:40 am
by Ravi.K
Please confirm whether the sequence number is not generating properly or Sorting order problem.
I checked this logic with "Round Robin Partition" and 4 node configuration file. The logic is working properly and explanation is as follows.
(((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1)
Partition 1:
((1 -1) * 4) + 0 +1 = 1
((2 -1) * 4) + 0 +1 = 5
((3 -1) * 4) + 0 +1 = 9
((4 -1) * 4) + 0 +1 = 13
Partition 2:
((1 -1) * 4) + 1 +1 = 2
((2 -1) * 4) + 1 +1 = 6
((3 -1) * 4) + 1 +1 = 10
((4 -1) * 4) + 1 +1 = 14
Partition 3:
((1 -1) * 4) + 2 +1 = 3
((2 -1) * 4) + 2 +1 = 7
((3 -1) * 4) + 2 +1 = 11
Partition 4:
((1 -1) * 4) + 3 +1 = 4
((2 -1) * 4) + 3 +1 = 8
((3 -1) * 4) + 3 +1 = 12
If you face Sorting order problem while collecting the records apply Sort Merge collection method on sequence number.
Posted: Mon Nov 22, 2010 3:04 pm
by ray.wurlod
The first partition number is 0, not 1.
Posted: Wed Nov 24, 2010 9:23 am
by Ravi.K
I mentioned first Partition number is 0 (Zero) right. Correct me If i coufused you.