Lookups/Joins propagating 0 instead of NULL - what the hell did the developers of DataStage not get about the concept of NULL?

I was driven quite crazy by DataStage when I set up a lookup stage where the main input does not necessarily find a companion in the input link. All the numerical columns of no-matches got the value 0 assigned.
  • I checked whether I happened to have defined a default - nope.
  • I checked whether the output link column is nullable - yes it is.
  • May seasoned DS colleague double checked - and had no idea why.
  • Some forum of entry of 2005 told me that also the INPUT column must be nullable - bingo! It was not, changing it to nullable (maybe one has to have some stage element between the lookup and a source like a database connection) et voilà the desired and expected behaviour manifested. I tried to use a Modify stage for this purpose such that it gets clear that the change is fully intentional but it aborted gibbering something about enablePrinting.
I suppose other stages like Merge will have the same problem but I did not check.

@ Those developers: NULL is not 0. It means "we do not know". Maybe the following analogy helps you to get the point. Imagine you work paid by the hour but get cashed out weekly. So you start on Monday and on Wednesday somebody asks you how much do you get paid on Friday. Do you say 0? Probably not, if you exactly know how many hours you are supposed to work until Friday you might calculate that hypothetical value but what if you get sick... Or even easier, you are a craftsman and not only produce on order but also just for fun and sell your work. Could you tell how much you earned at the end of the week before Friday evening? Would you say 0? You would say something like "I know that my employer owes my money by Friday but I DO NOT KNOW yet how much it will be". Or in the later case "I DO NOT KNOW yet, maybe I can sell some of my work on Friday bazaar." Got it?

Kommentare

Beliebte Posts aus diesem Blog

Error when checking operator: Could not find input field 'field_name'

Missing record delimiter "\n", saw EOF instead