Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
(date, vid, duration)
}). The filter (t=& gt; T. _1! T==null). The filter (& gt; T. _2! T==null). The filter (& gt; T. _3!=null.) take (10)
Do I want to select three elements are not empty triples how to write, so I write short of purpose, aunt for help
CodePudding user response:
The filter screen is suitable for the key - value such RDDYou can
val result1=RDD. The map (x=& gt; {
Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
Val key=date
Val value=https://bbs.csdn.net/topics/vid+, "" + duration
(key, value)
}). The filter (t=& gt; T. _1! T==null). The filter (& gt; (t. _2. The split () ", ") (0). T==null). The filter (& gt; (t. _2. The split () ", ") (1)!=null.) take (10)
CodePudding user response:
val result1=RDD. The map (x=& gt; {
Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
(date, vid, duration)
}) filter (RDD=& gt; {
If (RDD _1!=null & amp; & RDD _2!=null & amp; & RDD _3!=null)
{
True
} the else
{
False
}
}.) take (10) It can be try
CodePudding user response:
Val result1=RDD. The map (x=& gt; {Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
(date, vid, duration)
}). The filter (t=& gt; T. _1!=null& & T. _2!=null & amp; & T. _3!=null.) take (10)
CodePudding user response:
Suggest using third-party tools, confused here recommended tools: https://hutool.cn/docs/#/Val result1=RDD. The map (x=& gt; {
Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
(date, vid, duration)
}) filter (tp=& gt; StrUtil. IsNotBlack (tp) _1) & amp; & StrUtil. IsNotBlack (tp) _2) & amp; & StrUtil. IsNotBlack (tp) _3).) take (10)
CodePudding user response:
Val result1=RDD. The map (x=& gt; {Val data=(", "https://bbs.csdn.net/topics/x.split
Val date=data (0)
Val vid=data (11)
Val duration=data (16)
(date, vid, duration)
}). The filter (t=& gt; T. _1!=null& & T. _2!=null& & T. _3!=null)
CodePudding user response:
What has kept you so busy latelyCodePudding user response:
The