Page 1 of 2

Null handling in schema file

Posted: Fri Feb 19, 2010 3:04 am
by Poovalingam
Hi,
I'm facing warning message as "Exporting nullable fileld without null handling properties" in the stage in target position. The job is using schema file. I handled null in schema file as empty spaces.

Here comes the list of stages in the job,

1. sequential file ( source - using schema file)
2. Oracle (Upsert)
3. Reject link from oracle to Transformer ( just to abort the job if reject record count exceeds n)
4. 1st Output of transformer to sequential file.
5. 2nd output to Peek stage (just to give the condition saying abort)

In the 4th stage, the record is not getting inserted if NULL values are coming from the transformer(source).

Kindly suggest me what can I do on this case without changing the design using schema file.


Many thanks,
Poovalingam.

Posted: Fri Feb 19, 2010 3:24 am
by ArndW
Go to your output sequential file stage and column view, double-click on the column number for the nullable field and see if the column meta data actually does show that you are handling nulls.

Posted: Fri Feb 19, 2010 6:25 am
by Poovalingam
Hi Arndw,
Since I'm using schema file, No column names or column no's are there to check the nullable handling.


Thanks & Regards,
Poovalingam.

Posted: Fri Feb 19, 2010 3:28 pm
by ray.wurlod
Then make sure that the schema file includes Null Field Value properties either in the format string or in the column definitions. Or both.

Posted: Sun Feb 21, 2010 11:41 pm
by Poovalingam
Thanks Ray..

I have prepared the schema file for target stage as well and it is working fine now.


Regards,
Poova.

Posted: Mon Feb 22, 2010 11:51 am
by Sreenivasulu
Nice to know that you used schema file to load data. Never came across to me to try this option

I feel that when you are reading the file you would not written the 'null' handling feature properly.



Regards
Sreeni

Posted: Mon Feb 22, 2010 3:59 pm
by ray.wurlod
I disagree. That's how the null values got to be in the job in the first place. Because they were being interpreted from the source file.

Posted: Tue Jul 27, 2010 1:33 pm
by Nagin
Ray,
I have a similar requirement. I need to reject if the incoming column is null with schema file at the source sequential file stage itself.

Can you please share if you have an example of how to specify null field value properties in the format string or column definitions?

Thank You.

Posted: Tue Jul 27, 2010 2:10 pm
by anbu
Define the field as non-nullable and add a reject link to the sequential file.

Code: Select all

field name:nullable data type

Posted: Tue Jul 27, 2010 2:28 pm
by Nagin
By default columns are not nullable in a schema file. So, I tried it, but it is not getting rejected. If I specify Column:not nullable the job throws an error and says Unknown schema type.

Here is the content of my schema file

record{final_delim=none, delim='|', quote=none, charset="ISO8859-1"}
(
Col_One:nullable int32;
Col_two:string[10];
Col_Three:string[15];
)

I was wondering if there is an option I should specify in the record definition itself like the delim='|'.

May be some thing like
record{final_delim=none, delim='|', quote=none, null_filed_value="", charset="ISO8859-1"}

Do you have any idea Anbu?

Posted: Tue Jul 27, 2010 3:01 pm
by anbu
Yes by default the columns are not nullable in the schema file.

Did you see any warnings in the director when all the columns are defined as not nullable in schema file?

Posted: Tue Jul 27, 2010 11:44 pm
by nkbasakater
Hi Poovalingam,
You can modify your schema file like the following:
record
{final_delim=end, delim='|', null_field='', quote=none, charset="ISO8859-1"}
(
Col_One:nullable int32;
Col_two:string[10];
Col_Three:string[15];
)

null_field='' will specify- On import, the value given to a field containing a null. On export, the value given to an exported field if the source field is set to null.

Thanks,
Nil Kamal

Posted: Wed Jul 28, 2010 10:26 am
by Nagin
Thank you Nil Kamal for null_filed. It works without any syntax problems.

But still, the source sequential file is rejecting if it gets a null in place of an integer but not a string. Is the string null handling different?

Any ideas all you experts out there??

Posted: Wed Jul 28, 2010 10:30 am
by anbu
Do you see any warnings in director if you remove nullable property from your column Col_One?

Posted: Wed Jul 28, 2010 11:25 am
by greggknight
record

{final_delim=end, record_delim='\n', delim=',', null_field="", quote=double}

(

DM_TIMESTAMP:timestamp;

DM_TXID:string;

DM_OPERATION_TYPE:string;

DM_USER:string;

BEFORE_COMPANY:nullable string {null_field=''};

BEFORE_FACDIVN:nullable string {null_field=''};