请帮我把 pig 做完
Input:
record1: ("Ammit", 123, 234, 345)
record2: (map : [
"123" : ("accountNo": 123, "bank": "ICICI Bank", "branch" : "Delhi"),
"234" : ("accountNo": 234, "bank": "HDFC Bank", "branch" : "Mumbai"),
"345" : ("accountNo": 345, "bank": "SBI", "branch" : "Bangalore"),
])
上面的数据代表Amit的银行帐户,其中包含accountNo,银行和分行的详细信息。 Record1包含名称,后跟3个帐号ID(按顺序排列)(即,它们代表Amit开户的顺序)
output: ("Amit",
"123" : ("accountNo": 123, "bank": "ICICI Bank", "branch" : "Delhi"),
"234" : ("accountNo": 234, "bank": "HDFC Bank", "branch" : "Mumbai"),
"345" : ("accountNo": 345, "bank": "SBI", "branch" : "Bangalore"),
)
我该如何实现?
最佳答案
您可以展平 map ,然后合并联接将保持顺序
https://wiki.apache.org/pig/PigMergeJoin
关于hadoop - Pig:单个语句中有多个联接语句,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23512907/