Spark / Scala udf应该返回一个元组列表,例如Pig中的一个包

我有一个查找表,它是一个复合键=>(列,值) 给定一个数据集,我希望能够查看列和列的值,并验证该值是否存在于查找表中。如果是这样,我想为此掏出一张唱片。

我广播了查询,并编写了udf来处理传入的行,以根据列中是否存在匹配项将其扩展为多行

val explodeRow = udf{(row: Row,customFields : Set[CompoundKey],inputCustomFields : Array[String])
// customFields => lookup table
// inputCustomFields => dynamic list of columns to look at

Expected output => List/Array/Seq[CustomFieldExpansion]  
case class CustomFieldExpansion(<staticcol> : String,<staticcol> : 
String,customFieldKey : String,customFieldVal : String)

我在尝试从udf发回元组或包列表时遇到麻烦。数据集和dfs将无法工作,直到我通过Spark会话,我认为这不是一个好习惯。欢迎任何想法和建议!谢谢!

tkhxq 回答:Spark / Scala udf应该返回一个元组列表,例如Pig中的一个包

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3151303.html

大家都在问