Converting a nullable source to a non-nullable result
Moderators: chulett, rschirm, roy
Converting a nullable source to a non-nullable result
I have 5 columns in a table. I am taking only one column from the table and writing it to a Seq file.This is Parallel job.
and the column is not nullable.The column is set is not nullable in the Target i.e the sequential file.it is a simple load from a
table to a file.I am getting the following warning.
"Converting a nullable source to a non-nullable result".
Please suggest how I can get rid of this warning
and the column is not nullable.The column is set is not nullable in the Target i.e the sequential file.it is a simple load from a
table to a file.I am getting the following warning.
"Converting a nullable source to a non-nullable result".
Please suggest how I can get rid of this warning
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You mean the column in the target is NOT NULLABLE and the source column may be NULL? In this case why not check if the coming column has nulls and if yes initialize the value with not nulls, empty values, spaces....Check "Null Handling Functions" in Parallel Jobs like NulltoZero(), NulltoEmpty() etc.
The idea is NOT to send NULL VALUES to target columns.
The idea is NOT to send NULL VALUES to target columns.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
record
{final_delim=end, record_delim='\n', delim=',', quote=double}
(
Col1:int16 {quote=none};
Col2:string[max=20] {prefix=2};
Col3:string[max=15] {prefix=2};
)
This is the record schema of the source which is SQL table.I am taking only Col1 to target and writing it to a sequential file.I defined the Col1 as not nullable in target.
{final_delim=end, record_delim='\n', delim=',', quote=double}
(
Col1:int16 {quote=none};
Col2:string[max=20] {prefix=2};
Col3:string[max=15] {prefix=2};
)
This is the record schema of the source which is SQL table.I am taking only Col1 to target and writing it to a sequential file.I defined the Col1 as not nullable in target.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You say you have five columns, you show me a record schema with three columns, and that you are discarding two of those. Why not select just the one column that you need? To get rid of the error, just do as it says - add some null handling.
I suspect there is more to your job design than you are telling us. For example, a "full and complete" error message would include the name of the stage/operator that generated it, allowing us to narrow our diagnostic focus.
I suspect there is more to your job design than you are telling us. For example, a "full and complete" error message would include the name of the stage/operator that generated it, allowing us to narrow our diagnostic focus.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I am sorry I forgot to mention that when extracting data from table I am writing a User-defined query.select max(col1) from table. I played around by taking out max(col1) and just extract select col1 from table. I dont get that warning.but if I give select max(col1) from table then I get the warning.
Any suggestions to get rid of this warning plz?.
Any suggestions to get rid of this warning plz?.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
SQL Functions are always assumed to be able to deliver null (and therefore to be nullable). Short of using an intermediate temporary table I don't believe there is any solution. You could use a message handler to demote the message to informational.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
You haven't mentioned your database, but what about doing something like this, which is Oracle syntax:
A null result would be substituted with a zero (or whatever would be more appropriate) and then you could make the source column non-nullable. Yes no maybe so?
Code: Select all
select NVL(MAX(col1),0) from table
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: