Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BSajjad1615375415
Contributor
Contributor

java.lang.NullPointerException

Exception in component tMap_3 (pcrfvspgwsmalldata)

java.lang.NullPointerException

at newproj.pcrfvspgwsmalldata_0_1.pcrfvspgwsmalldata.tFileInputDelimited_4Process(pcrfvspgwsmalldata.java:3903)

at newproj.pcrfvspgwsmalldata_0_1.pcrfvspgwsmalldata.runJobInTOS(pcrfvspgwsmalldata.java:7434)

at newproj.pcrfvspgwsmalldata_0_1.pcrfvspgwsmalldata.main(pcrfvspgwsmalldata.java:7283)

Lines from the code:

Var.Variance = row6.Sum - row4.Diff;// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

tFileInputDelimited_4Process(globalMap);

int exitCode = pcrfvspgwsmalldataClass.runJobInTOS(args);

The tmap function is doing a join between two data sets and difference between values of two columns

Labels (3)
10 Replies
gjeremy1617088143

Hi, maybe row6.Sum or row4.Diff have null value.You have to make it null safe

Send me Love and kudos

BSajjad1615375415
Contributor
Contributor
Author

Sum and Diff columns are float type. How do I make them null safe?

gjeremy1617088143

use Float instead of float

 check null value for each and if one of them is null, reject it or pass a null value instead of the difference

gjeremy1617088143

(row6.Sum == null || row4.Diff == null)?null:row6.Sum - row4.Diff;

 

float are not good for precision , you'll better use other type like bigDecimal for example.

BSajjad1615375415
Contributor
Contributor
Author

Thanks so much. This removed the error.

 

But I want the output like 6-null=6,

similarly, null-6=-6

null should be replaced with 0 in row6.Sum and row4.Diff

gjeremy1617088143

(row6.Sum ==null?0F:row6.Sum)-(row4.Diff==null?0F:row4.Diff);

BSajjad1615375415
Contributor
Contributor
Author

Thanks . I was doing the same thing but with 0 not 0F. That was obviously giving type mismatch errors.

gjeremy1617088143

0f ,0F, new float(0),new Float(0) can work

BSajjad1615375415
Contributor
Contributor
Author

Is there a way to pivot total of values in Talend.

 

For example, for 'ID' cloumn that has XX123, XX123 entries, I want sum of all values in column 'Volume' pertaining to XX123 ID.

 

 

Excel attached