Possible truncation of variable length string
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
Possible truncation of variable length string
All,
I have a simple job which will generate the header and current date.
The job design is:
Row Generator --> Tranformer --> Export Column --> SeqFile
Header1 varchar(20)
Header2 varchar(20)
'UHDR' = Header1
DateToString(currentdate(),"%yyyy%ddd") = Header2
export_header:
exported_col varchar(255)
header1 & header2 will be stored in 'exported_col' as below
UHDR|2011101
when i run the job, i am getting the below error message.
export_header: When checking operator: When binding output interface field "exported_col" to field "exported_col": Implicit conversion from source type "string" to result type "string[max=255]": Possible truncation of variable length string.
why? I don't understand this error message.
I have a simple job which will generate the header and current date.
The job design is:
Row Generator --> Tranformer --> Export Column --> SeqFile
Header1 varchar(20)
Header2 varchar(20)
'UHDR' = Header1
DateToString(currentdate(),"%yyyy%ddd") = Header2
export_header:
exported_col varchar(255)
header1 & header2 will be stored in 'exported_col' as below
UHDR|2011101
when i run the job, i am getting the below error message.
export_header: When checking operator: When binding output interface field "exported_col" to field "exported_col": Implicit conversion from source type "string" to result type "string[max=255]": Possible truncation of variable length string.
why? I don't understand this error message.
Karthik
In your job, the column export stage is outputting an unbounded varchar() column (no defined max length). By placing a length of 255 on the output link metadata for the column, you have told the parallel engine to limit the length to 255 bytes (bounded varchar() ). This is done immediately after the operator when the job runs (look in the generated OSH for a modify statement attached to the output of the export operator). The warning is there because of the change from unbounded to bounded varchar().
Regards,
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Always specify a maximum string length (VarChar(255) for example) or always specify unbounded VarChar.
There are pros and cons to both approaches, discussed elsewhere.
There are pros and cons to both approaches, discussed elsewhere.
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.
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
-
- Participant
- Posts: 57
- Joined: Wed Oct 21, 2009 4:46 am
- Location: India
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm