Page 1 of 1

Converting a nullable source to a non-nullable result....

Posted: Tue Oct 09, 2012 12:44 pm
by kaps
I am facing a problem when using Lookup stage. Job design is Seq file, join stage(with seq file), look up stage(with DB2 Connector stage) and few other join stages after that.
In the lookup stage, I am doing range lookup on the Version From and To dates in the table with a date field(appl date) comes out of join stage.
I have the Version from and to dates and the appl date all defined as nullable in the table definition. I understand that these fields can't be NULL and we are correcting it but why would it give such a warning ?
When checking operator: When binding input interface field "VERSION_FROM_DATE" to field "VERSION_FROM_DATE": Converting a nullable source to a non-nullable result;
a fatal runtime error could occur;
use a modify operator to specify the value to which the null should be converted.
and then failed with the error :
Null in field "VERSION_FROM_DATE "; the result is non-nullable
and there is no handle_null to specify a default value.
Null in field "VERSION_TO_DATE "; the result is non-nullable
and there is no handle_null to specify a default value.
So, I had changed sql in DB2 connector stage to give a default value if version from and to dates are null. Now the job does not fail but I still have the same warning.

My questions are:

1. Why would it throw above warning and the error when all those fields are nullable ?
Is it because those fields are used in the range lookup ?

2. How can I get rid of the warning message ?

Posted: Tue Oct 09, 2012 3:28 pm
by ray.wurlod
It's not about whether no nulls appear in the data. This warning is driven by the metadata. You have to make the receiving columns Nullable if there is any possibility (that is, any upstream Nullable column that feeds them) of a Null arriving, even though you know there aren't any.

Posted: Tue Oct 09, 2012 5:38 pm
by chulett
You'll have the same issue with any kind of derived field, like a sum for example. Even if you are summing non-nullable fields, it will always consider the result to be nullable.

Posted: Thu Oct 11, 2012 11:29 am
by kaps
What I don't understand is that the columns are nullable even in the database but it spits the error message as :
Converting a nullable source to a non-nullable result

These columns are not propagated further down and it's just used for range lookup. Why does it throw entirely opposite warning ?

Thanks

Posted: Thu Oct 11, 2012 3:43 pm
by ray.wurlod
Read EVERYTHING in the error message. We know the column that's throwing the warning, but in which stage?