Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Data Types

What's the difference between an Int and Integer in Talend Open Studio. Sometimes it shows one or the other and because of that I seem to get a NullPointerException. Can anyone explain what causes talend to use one over the other.
Thanks
Labels (2)
5 Replies
Anonymous
Not applicable

Hi
It seems we have to talk about Java. 0683p000009MA9p.png
An int is a primitive. It is not an Object. An int is a high performance, streamlined beast for calculating numbers.
An Integer, is a Object that contains a single int field. An Integer is much bulkier than an int. It is sort like a Fedex box to contain the int. Integers are immutable.
Always they will be transfered automatically by JVM.
In TOS, they are the same as Java.
So i don't think they will cause a NullPointerException.
Best regards!
Pedro
Anonymous
Not applicable

To add to that, since an "int" is a primitve and not an Object, it does not inherit java.lang.object methods like toSting() or equals() (Lets not get into autoboxing/unboxing) and and cannot be null since null is not a valid integer. This is why when a column in "not nullable" it is an int but when changed to allow nulls becomes an Integer, because it can then be tested against null like 'row1.myInteger == null ? 0 : row1.myInteger'
_AnonymousUser
Specialist III
Specialist III
Author

Ok, so we understand the different between Java's int vs integer. However, the problem is in Talend, not java.
We can't figure out why sometimes Talend uses an "int" (the primitive type) for an int field, and sometimes it has used an "integer". What we want is an "integer" object representation, since it *is* acceptable for the field to have null values. Right now, we have a tmap in which the "left" part of the tmap is using primitive ints; and the right hand is using "integer", and since we have null values in our data, we eventually get "NullPointerExceptions" etc. How can we make all of the Talend int fields into Integer fields?
_AnonymousUser
Specialist III
Specialist III
Author

Ok, so we understand the different between Java's int vs integer. However, the problem is in Talend, not java.
We can't figure out why sometimes Talend uses an "int" (the primitive type) for an int field, and sometimes it has used an "integer". What we want is an "integer" object representation, since it *is* acceptable for the field to have null values. Right now, we have a tmap in which the "left" part of the tmap is using primitive ints; and the right hand is using "integer", and since we have null values in our data, we eventually get "NullPointerExceptions" etc. How can we make all of the Talend int fields into Integer fields?
Anonymous
Not applicable

Hi
When you check 'Nullable' of this column in your schema, you will change int type into Integer.
Best regards!
Pedro