Skip to content

spark Java UDF not invoking - error org.apache.spark.SparkException: Task not serializable #1

@satishpalli

Description

@satishpalli
UDF1<String, String> formatId = new UDF1<String, String>() {

					// @Override
					public String call(String id) throws Exception {
						return "00" + id;
					}
				};

				// register udf in your spark session
				sparskSession.udf().register("format_id", formatId, DataTypes.StringType);

Dataset dfstage2 = df.withColumn("PHONE", callUDF("format_id",df.col("SUBSNO")))

while executing above code - Task Not Serializable Exceptin getting.
Please help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions