Five Stars

tSalesforceInput with Bulk Query - error parsing integers and doubles

Hi - I am using tSalesforceInput to perform a Bulk Query on Account which has a total of 12 records.  When I run the job I receive the  errors below, depending on if the records contain Integers or Doubles.  If I change the schema of the tSalesforceInput and either delete the integer/double fields, or change the field types to strings, the job runs successfully.
Has anyone seen this before?
The errors received are as follows:
For Integers:
Exception in component tSalesforceInput_2
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at routines.system.ParserUtils.parseTo_int(ParserUtils.java:105)
    at routines.system.ParserUtils.parseTo_Integer(ParserUtils.java:112)
For Doubles:
Exception in component tSalesforceInput_2
java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
    at java.lang.Double.parseDouble(Unknown Source)
    at routines.system.ParserUtils.parseTo_Double(ParserUtils.java:86)

My Configuration details:
Talend version 5.6.0 - also happens on Talend 5.5.1, (32 bit and 64 bit)
Java version: 7 (also happens with 6)
tSalesforceInput --> tLogRow
tSalesforceInput settings:
Query Mode: Bulk Query
Login Type: Basic
WebService URL:  ""  -  ths is a recently created Developer edition on Winter 15, but this also happens on our Enterprise org also on Winter 15.
Salesforce Version: "21.0"  - have also tried 30 on both webservice URL and this setting.
Module:  Account
Proxy Settings:  uses enterprise proxy settings - no authentication required
Use Soap Compression:  On
5 REPLIES
One Star

Re: tSalesforceInput with Bulk Query - error parsing integers and doubles

It's a limitation in the bulk query.
Bulk query cannot return nulls, it returns them as empty strings.
Talend has no automated capability to handle this, so you have to change type to id_String and then change in tMap later.
Also, if you try to run a bulk query on large data (2m+ rows with 300+ columns) it will fail on Talend end.
One Star

Re: tSalesforceInput with Bulk Query - error parsing integers and doubles

This issue did not exist in version 5.4 and is new to 5.6. Given that the bulk query will only ever return empty strings, Talend should check for an empty string prior to parsing it. 
One Star

Re: tSalesforceInput with Bulk Query - error parsing integers and doubles

I did a bit more digging with this. I fixed it by editing the ParserUtils.java file and changing the logic to also check for empty strings. I'm on a Mac, so the path to do this on a PC might be different (I'd be surprised if it was though).
TalendV561 ? plugins ? org.talend.librariesmanager_5.6.1.20141207_1530 ? resources ? java ? routines ? system
You'll see a number of if statements where it's checking if s == null. I simply changed this to also check for an empty string by adding  || "".equals(s) :
public static Double parseTo_Double(String s) {
        if (s == null || "".equals(s)) {
            return null;
        }
        return Double.parseDouble(s);
    }
If it finds an empty string, it will return null (which is fine for what I'm doing). If you really do need it to return an empty string, you'll need to expand on the logic above.
Once you've done the above, restart Talend and try and run your job again.
One Star

Re: tSalesforceInput with Bulk Query - error parsing integers and doubles

I did a bit more digging with this. I fixed it by editing the ParserUtils.java file and changing the logic to also check for empty strings. I'm on a Mac, so the path to do this on a PC might be different (I'd be surprised if it was though).
TalendV561 ? plugins ? org.talend.librariesmanager_5.6.1.20141207_1530 ? resources ? java ? routines ? system
You'll see a number of if statements where it's checking if s == null. I simply changed this to also check for an empty string by adding  || "".equals(s) :
public static Double parseTo_Double(String s) {
        if (s == null || "".equals(s)) {
            return null;
        }
        return Double.parseDouble(s);
    }
If it finds an empty string, it will return null (which is fine for what I'm doing). If you really do need it to return an empty string, you'll need to expand on the logic above.
Once you've done the above, restart Talend and try and run your job again.

Thanks! This was the hack/fix I needed to get passed this error. I'm using tSalesforceOutputBulkExec and when Talend was in the process of writing the success/error records to some files it bombed when a Salesforce numeric field came back as empty string when it should have been null. Hopefully this is resolved in future release!
One Star

Re: tSalesforceInput with Bulk Query - error parsing integers and doubles

This fixed my issue as well!
Thank you