I am writing data into a DB2 database. Sadly this is slow because the ODBC driver.
For test purposes, I am sampling the data when the context "test" is used, else I take all of them.
To show the issue, I created a minimal working example:
It works flawlessly, when the "Range" field in "tSampleRow_1" component is set to: "1,5,10..20" (the pre-filled example).
What I tried and is not working is the following: "1.." + context.db2_table_HCWH2H1P_sampleSize
In the "test" context, the context variable is set to 100, and in "production" to 99999999.
The job is not compiling. The source shows:
String rangetSampleRow_1 = "1.." + context.db2_table_HCWH2H1P_sampleSize.split(",");
with the error:
Type mismatch: Cannot convert from String to String
My guess is, that "Talend Open Studio for Big Data" is taking the value in the "Range" field, and puts a '.split(",")' at the end.
What happens is, that the context variable gets split rather than the whole string. It ends up with a "String" and this mismatches the "String" variable type of "rangetSampleRow_1".
An easy solution is, to put some brackets around the "Range" field, and append the '.split(",")' after the closing bracket.
For my case, I worked around the problem by putting the whole string "1..100" into the context variable, rather than only the upper bound "100".
- Product: Talend Open Studio for Big Data
- Version: 6.4.1
- OS: Win10
- Java: JDK 1.8
Solved! Go to Solution.