<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Talend Big Data job failed due to null pointer issue at tSQLROW in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Talend-Big-Data-job-failed-due-to-null-pointer-issue-at-tSQLROW/m-p/2224738#M17332</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running a Talend Big data job on spark but has failed due to null pointer issue and could not figure out the root cause for it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer below log for issue:&lt;/P&gt;
&lt;P&gt;org.apache.spark.SparkException: Job aborted due to stage failure: java.lang.RuntimeException: java.lang.NullPointerException&lt;BR /&gt;at org.talend.bigdata.dataflow.functions.FlatMapperIterator.hasNext(FlatMapperIterator.java:75)&lt;BR /&gt;at scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41)&lt;BR /&gt;at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:388)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply$mcV$sp(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1277)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1203)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1183)&lt;BR /&gt;at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)&lt;BR /&gt;at org.apache.spark.scheduler.Task.run(Task.scala:89)&lt;BR /&gt;at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:227)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)&lt;BR /&gt;at java.lang.Thread.run(Thread.java:745)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am doing right outer join operation using tSQLROW where I suspect the issue lies but dont know the root cause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:45:48 GMT</pubDate>
    <dc:creator>hrishikesh_t</dc:creator>
    <dc:date>2024-11-16T03:45:48Z</dc:date>
    <item>
      <title>Talend Big Data job failed due to null pointer issue at tSQLROW</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Big-Data-job-failed-due-to-null-pointer-issue-at-tSQLROW/m-p/2224738#M17332</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running a Talend Big data job on spark but has failed due to null pointer issue and could not figure out the root cause for it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer below log for issue:&lt;/P&gt;
&lt;P&gt;org.apache.spark.SparkException: Job aborted due to stage failure: java.lang.RuntimeException: java.lang.NullPointerException&lt;BR /&gt;at org.talend.bigdata.dataflow.functions.FlatMapperIterator.hasNext(FlatMapperIterator.java:75)&lt;BR /&gt;at scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41)&lt;BR /&gt;at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:388)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply$mcV$sp(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1195)&lt;BR /&gt;at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1277)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1203)&lt;BR /&gt;at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1183)&lt;BR /&gt;at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)&lt;BR /&gt;at org.apache.spark.scheduler.Task.run(Task.scala:89)&lt;BR /&gt;at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:227)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)&lt;BR /&gt;at java.lang.Thread.run(Thread.java:745)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am doing right outer join operation using tSQLROW where I suspect the issue lies but dont know the root cause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:45:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Big-Data-job-failed-due-to-null-pointer-issue-at-tSQLROW/m-p/2224738#M17332</guid>
      <dc:creator>hrishikesh_t</dc:creator>
      <dc:date>2024-11-16T03:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Big Data job failed due to null pointer issue at tSQLROW</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Big-Data-job-failed-due-to-null-pointer-issue-at-tSQLROW/m-p/2527352#M147889</link>
      <description>&lt;P&gt;For thereported stack trace in a Talend Big Data Spark job almost always means that Spark is trying to iterate over rows from a tSQLRow join result, and one of the incoming records has a null value in a field the join or subsequent mapping expects to be non-null.&lt;/P&gt;&lt;P&gt;Because the Talend FlatMapperIterator (mechanism that allows you to loop through a set of Records) is just the wrapper that reads and transforms Spark RDD/DataFrame rows, the NullPointerException comes from your job logic — not from Spark itself.&lt;/P&gt;&lt;P&gt;What is the possible RC this Happens in tSQLRow Component with an Outer Join Query:&lt;/P&gt;&lt;P&gt;When you run an Example Query like:&lt;/P&gt;&lt;P&gt;SELECT a.col1, b.col2&lt;BR /&gt;FROM tableA a&lt;BR /&gt;LEFT OUTER JOIN tableB b&lt;BR /&gt;ON a.key = b.key&lt;/P&gt;&lt;P&gt;- For rows in tableA that have no match in tableB, all b.* fields will be null.&lt;BR /&gt;- If any later component (or even the same tSQLRow) tries to access those fields without null checks (e.g., calling .toString(), arithmetic, trimming), you get an NPE.&lt;/P&gt;&lt;P&gt;In Spark’s Talend wrapper, FlatMapperIterator.hasNext() is often where it blows up — because Talend’s generated Java code directly calls getters on nullable objects.&lt;/P&gt;&lt;P&gt;Possible Steps How to Fix this issue:&lt;/P&gt;&lt;P&gt;1. Check the schema definition in Talend Job&lt;BR /&gt;- For the outer join result, all fields from the nullable side of the join must be set as nullable in the Talend schema.&lt;BR /&gt;- In the tSQLRow output schema editor, make sure “Nullable” is checked for all columns that can be null from the join.&lt;/P&gt;&lt;P&gt;2. Use IFNULL / COALESCE in your SQL&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;SELECT&lt;BR /&gt;a.col1,&lt;BR /&gt;COALESCE(b.col2, '') AS col2,&lt;BR /&gt;COALESCE(b.amount, 0) AS amount&lt;BR /&gt;FROM tableA a&lt;BR /&gt;LEFT OUTER JOIN tableB b&lt;BR /&gt;ON a.key = b.key&lt;/P&gt;&lt;P&gt;This avoids nulls reaching downstream components.&lt;/P&gt;&lt;P&gt;3. Add Null Checks Before Processing&lt;BR /&gt;If you’re passing join results into a tMap or another Spark component:&lt;BR /&gt;- Use Talend expressions like:&lt;/P&gt;&lt;P&gt;row2.col2 != null ? row2.col2 : ""&lt;/P&gt;&lt;P&gt;to safely handle null values.&lt;/P&gt;&lt;P&gt;4. Watch for Generated Code Assumptions:&lt;/P&gt;&lt;P&gt;- Talend’s Big Data Spark jobs generate Scala/Java that may assume a column is never null if “Nullable” is unchecked in the schema.&lt;BR /&gt;- If unchecked, Talend calls .toString() or primitive conversions without guards → instant NPE.&lt;/P&gt;&lt;P&gt;5. Additional Investigation Debug the Null Source&lt;BR /&gt;If you’re unsure which column is null:&lt;BR /&gt;- Temporarily change the join to an inner join — if the job runs, the nulls are from the missing side.&lt;BR /&gt;- Or, in tSQLRow, add a CASE WHEN b.key IS NULL THEN 'MISSING' ELSE 'OK' END column to trace null origins.&lt;BR /&gt;- Always check the Job Data flow for when using possibly Component such tFileInputDelimitted the records passing to tSQLrow is properly formatted and complies with the Spark version requirement&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 15:05:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Big-Data-job-failed-due-to-null-pointer-issue-at-tSQLROW/m-p/2527352#M147889</guid>
      <dc:creator>Vahied</dc:creator>
      <dc:date>2025-08-14T15:05:14Z</dc:date>
    </item>
  </channel>
</rss>

