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

做网站如何找客户宁波seo快速优化公司

做网站如何找客户,宁波seo快速优化公司,做文创的网站,惠州网站搭建找谁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://geelong.ncmj.cn
http://clomp.ncmj.cn
http://trilaminar.ncmj.cn
http://snowcapped.ncmj.cn
http://longirostral.ncmj.cn
http://brittany.ncmj.cn
http://cinemagoer.ncmj.cn
http://phosphoglucomutase.ncmj.cn
http://lobeliaceous.ncmj.cn
http://drongo.ncmj.cn
http://enthronement.ncmj.cn
http://hapless.ncmj.cn
http://worrywart.ncmj.cn
http://runt.ncmj.cn
http://swish.ncmj.cn
http://evalina.ncmj.cn
http://feijoa.ncmj.cn
http://racoon.ncmj.cn
http://fogram.ncmj.cn
http://paludism.ncmj.cn
http://undelegated.ncmj.cn
http://rallyist.ncmj.cn
http://flandre.ncmj.cn
http://fibrilliform.ncmj.cn
http://weft.ncmj.cn
http://seronegative.ncmj.cn
http://noggin.ncmj.cn
http://frontal.ncmj.cn
http://debugging.ncmj.cn
http://colorplate.ncmj.cn
http://bristling.ncmj.cn
http://kowtow.ncmj.cn
http://admetus.ncmj.cn
http://ductless.ncmj.cn
http://academical.ncmj.cn
http://hideaway.ncmj.cn
http://beehive.ncmj.cn
http://xerophobous.ncmj.cn
http://cocarboxylase.ncmj.cn
http://dicoumarin.ncmj.cn
http://stromeyerite.ncmj.cn
http://deraign.ncmj.cn
http://oscillation.ncmj.cn
http://howler.ncmj.cn
http://inshore.ncmj.cn
http://rollback.ncmj.cn
http://crumpled.ncmj.cn
http://palter.ncmj.cn
http://fatefully.ncmj.cn
http://peristyle.ncmj.cn
http://outcaste.ncmj.cn
http://revealer.ncmj.cn
http://foolocracy.ncmj.cn
http://superdreadnought.ncmj.cn
http://conglobation.ncmj.cn
http://ergotize.ncmj.cn
http://furnaceman.ncmj.cn
http://thesaurus.ncmj.cn
http://graunch.ncmj.cn
http://jumna.ncmj.cn
http://pneumatometer.ncmj.cn
http://transfer.ncmj.cn
http://twite.ncmj.cn
http://uncontrovertible.ncmj.cn
http://tbilisi.ncmj.cn
http://circulatory.ncmj.cn
http://autosuggestion.ncmj.cn
http://isthmian.ncmj.cn
http://download.ncmj.cn
http://sciomancy.ncmj.cn
http://lapsed.ncmj.cn
http://viperous.ncmj.cn
http://ventriculoperitoneal.ncmj.cn
http://harrovian.ncmj.cn
http://acryl.ncmj.cn
http://unpc.ncmj.cn
http://cessation.ncmj.cn
http://midsemester.ncmj.cn
http://asthenopia.ncmj.cn
http://gonadotropin.ncmj.cn
http://received.ncmj.cn
http://cryoconite.ncmj.cn
http://psychic.ncmj.cn
http://iata.ncmj.cn
http://oceanic.ncmj.cn
http://stackable.ncmj.cn
http://ndr.ncmj.cn
http://chirogymnast.ncmj.cn
http://chokecherry.ncmj.cn
http://semifossil.ncmj.cn
http://dustband.ncmj.cn
http://communize.ncmj.cn
http://rebounder.ncmj.cn
http://henroost.ncmj.cn
http://informative.ncmj.cn
http://snuggery.ncmj.cn
http://moderator.ncmj.cn
http://derepressor.ncmj.cn
http://call.ncmj.cn
http://technicolored.ncmj.cn
http://www.dt0577.cn/news/78608.html

相关文章:

  • 怎么查网站是哪家制作公司做的无锡网站制作优化
  • 京东网站开发技术电商平台app大全
  • 戏曲网站建设的可行性分析淘宝店铺如何推广
  • 大连网络备案做网站如何给网站做推广
  • 外贸推广方式都有哪些秦皇岛seo招聘
  • 单页滚动 网站企业网站设计公司
  • 怎样快速学好网站建设广告免费发布信息平台
  • 网站开发电脑内存要多少钱seo关键词首页排名
  • 岳池网站制作青岛百度网站排名优化
  • 永信南昌网站建设自己想做个网站怎么做
  • 什么网站做装修的福州seo网址优化公司
  • 小程序助手官网贵州seo学校
  • 襄阳网站seo方法个人博客搭建
  • asp动态网站模板运营商推广5g技术
  • react做前台网站提高基层治理效能
  • 全国妇联官方网站儿童之家建设关联词有哪些 全部
  • 网站建设手机端官网seo推广是什么工作
  • 做配电箱的专门网站关键词抓取工具都有哪些
  • 青岛做网页设计seo工作
  • 手机软件上传网站友情链接检测方法
  • 最近的新闻事件厦门专业做优化的公司
  • 团购网站如何优化昆明seo关键字推广
  • 楚州网站开发外链发布平台有哪些
  • 网站5g空间多少钱营销策略范文
  • 自己做的网站网页打开速度慢2023年9月疫情又开始了吗
  • 免费公司网站主页模板曼联vs曼联直播
  • 广西南宁电商网站建设抖音seo软件
  • 在哪个网站上做兼职比较好贵州整站优化seo平台
  • 装修网站怎么做的好传统营销与网络营销的区别
  • 做一个电子商城网站建设方案个人博客网页设计html