当前位置: 首页 > news >正文

怎么给我 的网站做关键词百度网盘客服电话24小时

怎么给我 的网站做关键词,百度网盘客服电话24小时,ios软件开发用什么工具,一个人可以做网站吗1.需求 主播数据--按照观众人数降序排序,如果观众人数相同,按照直播时长降序 # 案例数据 用户id 观众人数 直播时长 团团 300 1000 小黑 200 2000 哦吼 400 7000 卢本伟 100 6000 八戒 250 5000 悟空 100 4000 唐僧 100 3000 # 期望结果 哦吼 4…

1.需求

主播数据--按照观众人数降序排序,如果观众人数相同,按照直播时长降序

# 案例数据

用户id 观众人数 直播时长

团团 300 1000

小黑 200 2000

哦吼 400 7000

卢本伟 100 6000

八戒 250 5000

悟空 100 4000

唐僧 100 3000

# 期望结果

哦吼 400 7000

团团 300 1000

八戒 250 5000

小黑 200 2000

卢本伟 100 6000

悟空 100 4000

唐僧 100 3000

2.将数据上传到hdfs

3.Idea代码

package demo6;import org.apache.hadoop.io.WritableComparable;import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;public class PlayWritable implements WritableComparable<PlayWritable> {private int viewer;private int length;public PlayWritable() {}public PlayWritable(int viewer, int length) {this.viewer = viewer;this.length = length;}public int getViewer() {return viewer;}public void setViewer(int viewer) {this.viewer = viewer;}public int getLength() {return length;}public void setLength(int length) {this.length = length;}@Overridepublic String toString() {return viewer + " " + length;}@Overridepublic void write(DataOutput out) throws IOException {out.writeInt(viewer);out.writeInt(length);}@Overridepublic void readFields(DataInput in) throws IOException {this.viewer = in.readInt();this.length = in.readInt();}@Overridepublic int compareTo(PlayWritable o) {if (this.viewer != o.viewer){return this.viewer > o.viewer ? -1 : 1;}return this.length > o.length ? -1 : (this.length == o.length ? 0 : 1);}
}
package demo6;import demo5.DescIntWritable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.checkerframework.checker.units.qual.Length;import java.io.IOException;public class Sort3Job {public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {Configuration conf = new Configuration();conf.set("fs.defaultFS","hdfs://hadoop10:8020");Job job = Job.getInstance(conf);job.setJarByClass(Sort3Job.class);job.setInputFormatClass(TextInputFormat.class);job.setOutputFormatClass(TextOutputFormat.class);TextInputFormat.addInputPath(job,new Path("/mapreduce/demo6/sort3.txt"));TextOutputFormat.setOutputPath(job,new Path("/mapreduce/demo6/out"));job.setMapperClass(Sort3Mapper.class);job.setReducerClass(Sort3Reducer.class);//map输出的键与值类型job.setMapOutputKeyClass(PlayWritable.class);job.setMapOutputValueClass(Text.class);//reducer输出的键与值类型job.setOutputKeyClass(Text.class);job.setOutputValueClass(PlayWritable.class);boolean b = job.waitForCompletion(true);System.out.println(b);}static class Sort3Mapper extends Mapper<LongWritable, Text, PlayWritable,Text> {@Overrideprotected void map(LongWritable key, Text value,Context context) throws IOException, InterruptedException {String[] arr = value.toString().split("\t");context.write(new PlayWritable(Integer.parseInt(arr[1]),Integer.parseInt(arr[2])),new Text(arr[0]));}}static class Sort3Reducer extends Reducer<PlayWritable,Text,Text,PlayWritable>{@Overrideprotected void reduce(PlayWritable key, Iterable<Text> values, Context context) throws IOException, InterruptedException {for (Text name : values) {context.write(name,key);}}}
}

4.在hdfs查看结果


请好好爱自己~ 想和你做朋友~

http://www.r43.cn/news/351.html

相关文章:

  • 福建省建建设行业信用评分网站全国免费发布信息平台
  • 临沧网站制作创建网站需要多少资金
  • 如何建国际商城网站高端营销型网站
  • 做网站javaee前端seo怎么优化
  • 做网站哪些有没有免费的广告平台
  • 杭州企业网站开发网站建设排名优化
  • 做球迷网站专业seo网络推广
  • 服务器iis搭建网站潮州网络推广
  • 国外做ae模板网站大全指数网站
  • b2b网站排行榜b2b平台推广
  • 建立一个网站的步骤谷歌独立站
  • 赣州信息网seo专员岗位要求
  • 成都市成华区建设委员会网站宁波seo教程行业推广
  • 无锡网站建设服务公司站长素材音效下载
  • 起点网站建设免费友情链接网站
  • php做学校网站免费各大网站提交入口
  • 附近量身定做衣服店湖南seo推广多少钱
  • 怎么用wordpress仿站推广方案框架
  • 网站建设的社会天津的网络优化公司排名
  • 重庆市设计公司网站线上推广的好处
  • 嘉定品牌网站建设500个游戏推广群
  • 中国建设银行网站首页joy百度推荐现在为什么不能用了
  • 嘉兴 网站建设广州网站快速优化排名
  • 做网站的前提百度总部公司地址在哪里
  • 温州微网站制作公司推荐企业网站seo排名
  • php做的网站如何该样式长尾关键词是什么
  • 盐城市规划建设局网站写软文能赚钱吗
  • h5可视化拖拽生成工具seo技术外包公司
  • 沙河做网站seo推广教程
  • 手机软件下载网站源码网站网址查询工具