How to resolve the AnalysisException: resolved attribute(s) in Spark

后端 未结 12 908
故里飘歌
故里飘歌 2020-12-14 07:03
val rdd = sc.parallelize(Seq((\"vskp\", Array(2.0, 1.0, 2.1, 5.4)),(\"hyd\",Array(1.5, 0.5, 0.9, 3.7)),(\"hyd\", Array(1.5, 0.5, 0.9, 3.2)),(\"tvm\", Array(8.0, 2.9,         


        
12条回答
  •  盖世英雄少女心
    2020-12-14 07:13

    It will work if you do the below.

    suppose you have a dataframe. df1 and if you want to cross join the same dataframe, you can use the below

    df1.toDF("ColA","ColB").as("f_df").join(df1.toDF("ColA","ColB").as("t_df"), 
       $"f_df.pcmdty_id" === 
       $"t_df.assctd_pcmdty_id").select($"f_df.pcmdty_id",$"f_df.assctd_pcmdty_id")
    

提交回复
热议问题