Page 1 of 1

vertical pivot is hanging

Posted: Mon Aug 12, 2013 6:14 pm
by raji33
Hi,

I have i/p as

id date gp code amt
1 1992-01-01 US abc 123
1 1992-01-01 US abc 124
1 1992-02-01 US abc 234
1 1992-03-01 US abc 245

Expected o/p

id gp code jan feb march april june july aug sept oct nov dec
1 US abc 247 234 245


i used pivot stage and type as vertical pivot . group by by id,gp,code and pivot column amt, array size 12

i am getting o/p as
id gp code jan feb march april june july aug sept oct nov dec
1 US abc 123 124 234

not sure where i am going wrong and also iam sending sorted data to pivot stage . Any suggestions please.

Thanks

Posted: Mon Aug 12, 2013 6:19 pm
by ray.wurlod
Look at your data. You have two entries for January. Use a Remove Duplicates stage to keep only the last in each group, if that's what you need.

Posted: Mon Aug 12, 2013 6:46 pm
by raji33
Thanks ray for quick response.

ya there are two entries for jan and i need both the records to be aggregated as single record . i tried using agrregator stage before pivot stage. But the job just hangs and is not proceeding further after aggregator stage.

Posted: Mon Aug 12, 2013 10:32 pm
by ray.wurlod
Did you specify "Sort" mode for the Aggregator stage, since your data are already sorted by the grouping key?

Posted: Tue Aug 13, 2013 6:22 am
by raji33
yes i did. its going out of aggregator stage but not comming out of pivot. Its hanging there.

Posted: Tue Aug 13, 2013 6:23 am
by chulett
How much data are we talking about? How long did you wait before you declared that it was hung?

Posted: Tue Aug 13, 2013 6:48 am
by raji33
its not huge data. I am testing on only 12 rows, I have waited for 20 mints.

Posted: Tue Aug 13, 2013 9:22 am
by raji33
Any alternate solution/suggestions/ideas to get my expected o/p.

Posted: Tue Aug 13, 2013 4:32 pm
by ray.wurlod
For starters, don't push. Your last two posts were at 10:48pm and 1:22am my time. DSXchange is an all volunteer site whose members post if and when they can, at the same time being under no obligation to do so.

If you effect the pivot using a Transformer stage, does it still hang?

How, precisely, are you configuring the PXPivot stage?