Manipulating a dataframe within a Spark UDF

后端 未结 3 531
别跟我提以往
别跟我提以往 2021-01-21 10:18

I have a UDF that filters and selects values from a dataframe, but it runs into \"object not serializable\" error. Details below.

Suppose I have a dataframe df1 that has

3条回答
  •  感情败类
    2021-01-21 10:57

    1) No, you can only use plain scala code within UDFs

    2) If you interpreted your code correctly, you can achieve your goal with:

    df2
      .join(
        df1.select($"ID",y_list.foldLeft(lit(0))(_ + _).as("Result")),Seq("ID")
      )
    

提交回复
热议问题