代码实现 

// rdd转化为df[kv格式]
val df = sqlContext.createDataFrame(check_data_type, structType) .select("cons_no", "org_no")
.distinct // 去重 .rdd .map(row
=> (row.getAs[String]("cons_no"), row.getAs[String]("org_no"))) .collect()// 数据量较少 .toMap[String, String] // 模式匹配 val value = df.get("2019") match{ case Some(a) => a // 提取出数据 case None => "" } println(value)

 

相关文章:

  • 2021-11-30
  • 2021-06-09
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2021-11-13
猜你喜欢
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案