# Invalid class exception in CSV to Spark node

**URL:** <https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811>\
**Category:** KNIME Extensions\
**Tags:** big-data-extension, big-data\
**Created:** [October 5, 2020, 12:01pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811 "2020-10-05T12:01:53Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 12:01pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/1 "2020-10-05T12:01:53Z")

</div>

Hii,  
I am getting below error while executing ‘csv to spark’ node …

**ERROR CSV to Spark 0:3 Execute failed: org.apache.spark.sql.execution.FileSourceScanExec; local class incompatible: stream classdesc serialVersionUID = 1920947604238219635, local class serialVersionUID = -3589590085483687218 (InvalidClassException)**

Also attaching log file and workflow screenshots…[knime\_log.txt](https://forum.knime.com/uploads/short-url/k2DAHYHtZ6BCNN8Le4446K7xEvm.txt) (19.3 KB)

 ![Screenshot from 2020-10-05 16-18-36](https://forum-cdn.knime.com/uploads/default/original/3X/9/4/94a156fdc7672109b077cb8cb7f561440d49be33.png) ![Screenshot from 2020-10-05 17-06-37](https://forum-cdn.knime.com/uploads/default/original/3X/6/f/6f2bc9c59cd92eeac056adf54b4586de924864e5.png)

---

<div class="post-metadata">

**Author:** ![bjoern.lohrmann](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bjoern.lohrmann](https://forum.knime.com/u/bjoern.lohrmann)\
**Post date:** [October 5, 2020, 2:05pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/2 "2020-10-05T14:05:50Z")

</div>

Hi @06mickey

looking at the knime.log (thanks for providing), it looks like some Spark internal data serialization between Spark driver and executor is failing.

This really only happens if you are using different Java and/or Spark versions between your cluster nodes. These must all be the exact same versions.

Could that be the case?

Best,  
Björn

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 3:22pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/4 "2020-10-05T15:22:10Z")

</div>

I m using spark version 2.4 and livy 0.7 and knime latest version (4.2.1) , If these are not stable versions of spark & livy for knime 4.2.1 , plaese let me know the correct ones.

---

<div class="post-metadata">

**Author:** ![sascha.wolke](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/e0b2c6/32.png) [@sascha.wolke](https://forum.knime.com/u/sascha.wolke)\
**Post date:** [October 5, 2020, 3:44pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/5 "2020-10-05T15:44:33Z")

</div>

Hi @06mickey,

Spark 2.4 and Livy 0.7 should work fine with KNIME 4.2.1. What type and version of cluster your are using? (CDH/HDP/AWS EMR/Azure…)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 3:47pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/6 "2020-10-05T15:47:46Z")

</div>

Could you first load the data into KNIME and see what types are there and what the Type mapping does say. Or if there are strange values with NaN(not a number).

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 5:58pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/7 "2020-10-05T17:58:50Z")

</div>

There are only string and integer dtypes in my data and no missing values…  
still the same error

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 6:03pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/8 "2020-10-05T18:03:36Z")

</div>

Have you tried converting the integers to doubles (I am aware this sounds counter intuitive) and then upload the data. Maybe start with the numbers only.

And could you check into what type of variable your integers would be converted.

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 6:26pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/9 "2020-10-05T18:26:04Z")

</div>

have converted all the integer column to doubles & tried it , still the same error persists…

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 6:32pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/10 "2020-10-05T18:32:50Z")

</div>

Did you use the node:

> **[Table to Spark](https://hub.knime.com/knime/extensions/org.knime.features.bigdata.spark/latest/org.knime.bigdata.spark.node.io.table.reader.Table2SparkNodeFactory2)**
>
> Creates a Spark DataFrame/RDD from the KNIME data table. KNIME's LocalTime and ZonedDateAndTime data types are not supported by Spark. The Modify Time Zone Nod…

You could set the LOG level to DEBUG and try again. Maybe we could get an idea. It you could share a sample of the data that is failing that might also help.

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 6:53pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/11 "2020-10-05T18:53:49Z")

</div>

are you talking about using ‘Table to spark’ node instead of ‘csv to spark’ node?

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 6:58pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/12 "2020-10-05T18:58:17Z")

</div>

Yes I do. This could give you more control off the formats. BTW: how did you convert the integers to doubles anyway.

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 7:00pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/13 "2020-10-05T19:00:23Z")

</div>

with the help of column rename node

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 7:02pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/14 "2020-10-05T19:02:52Z")

</div>

Column rename is notorious for messing up formats. You might want to use another converter. But I am not sure it is about integers or doubles.

You might have to map integers to bigint in a big data environment.

---

<div class="post-metadata">

**Author:** ![06mickey](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/0/bbe5ce/32.png) [@06mickey](https://forum.knime.com/u/06mickey)\
**Post date:** [October 5, 2020, 7:30pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/15 "2020-10-05T19:30:17Z")

</div>

Ok i ll try that too , but for now can you tell me how to connect table to spark node with ‘Hdfs connection’ node & ‘spark context’ node simultaneously which is possible with ‘csv to spark’ node as shown in my workflow…because the csv file I want to use is on hdfs .

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 5, 2020, 8:33pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/16 "2020-10-05T20:33:17Z")

</div>

> [@06mickey](#):
>
> because the csv file I want to use is on hdfs

Then you could try and tell Hive or Impala to treat it as an external table and load that into spark. You could declare the formats as string, int or bigint or double.

> **[KNIME and Hive - load multiple CSV files at once via external table – mlauber71](https://hub.knime.com/mlauber71/spaces/Public/kn_example_bigdata_hive_csv_loader/m_001_import_hive_csv~O70S2RenR3hEyzLB/current-state)**
>
> KNIME and Hive - load multiple CSV files at once via external table. Also: toy around with internal and external tables and then create a Hive table with a par…

(The green block on top)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 6, 2020, 5:28am UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/17 "2020-10-06T05:28:20Z")

</div>

> [@mlauber71](#):
>
> The green block on top

Has to be the part _beneath_ the green block

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [April 6, 2021, 5:28pm UTC](https://forum.knime.com/t/invalid-class-exception-in-csv-to-spark-node/27811/18 "2021-04-06T17:28:22Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
