Page 1 of 1

Conditional Lookups where condition references an input col

Posted: Tue May 20, 2008 10:27 am
by fridge
Hi,

I am probably being dense (dont all shout at once) but have a simple job

read Seqfile A do lookup (lookup based on single key value, lookup data fed into lookup stage from Sequential file B) and wanted to do the lookup ONLY if A.FIELD <> something - but when building the expression the input columns option on the dropdown list was grey-out (other options, functions, DSMacro etc all fine and dandy)

Okay ladies and gents - what am I missing

Posted: Tue May 20, 2008 4:29 pm
by ray.wurlod
At this point in time ARE there any input columns to the Lookup stage?

Posted: Tue May 20, 2008 4:40 pm
by fridge
evening ray , yes there are input columns being fed into the lookup stage , this is a design rather than a runtime issue - just cant select input columns as an option from the dropdown

Actually sorted the functional issue with what is commonly known in UK as 'fudge' but in my never-ending quest for knowledge I would like to know why I cant use input columns in conditional expression, I blame myself for missing something , but again that is a UK thing

Posted: Wed May 21, 2008 4:00 am
by ArndW
I can't check now, but could it be related to a sparse/non-sparse lookup setting?

Posted: Wed May 21, 2008 5:04 am
by OddJob
I just tried a simple job to test this:

Seq File, one field called 'Key', input to Look Up.
Seq File, two fields called 'Key', 'Data', reference to Look Up.

Perform look up between field 'Key', outputting 'Key' from input link, and 'Data' from reference link.

When I try to add a Condition I can select 'Input Column' from the list, no problems.

I'm running 7.5.1A. Sorry this isn't any help. Can you hand type the condition including the input column link and name?

Ray, not sure if the idea about Sparse look-up holds true here because we're only dealing with Sequential File, not DB stage, and sparse is set up in the directly joining stage, not the look-up stage.

Posted: Wed May 21, 2008 6:13 am
by Mike
I think Arnd is probably on the right track with sparse/non-sparse.

A flat file lookup (or non-sparse database lookup) reads the entire lookup into memory. The lookup function will be very fast... no need for a condition.

In a sparse lookup (database), individual SELECT statements are issued to the database... a very expensive operation that would benefit from being conditional.

Mike

Posted: Wed May 21, 2008 7:07 am
by OddJob
My test job used Sequential Files that cannot take advantage of Sparse look-ups but I did have access to the input columns.

Posted: Fri May 23, 2008 5:55 am
by fridge
sussed it - it WAS just a case of hard coding the condition - just seems for some reason that the menu option borked

thanks for input guys