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

设计一个企业网站报价郑州网络运营培训

设计一个企业网站报价,郑州网络运营培训,可以拿自己电脑做网站主机,版面设计教案TopN 定义(⽀持 Batch\Streaming): TopN 对应离线数仓的 row_number(),使⽤ row_number() 对某⼀个分组的数据进⾏排序。 应⽤场景: 根据 某个排序 条件,计算 某个分组 下的排⾏榜数据。 SQL 语法标准&am…

TopN 定义(⽀持 Batch\Streaming): TopN 对应离线数仓的 row_number(),使⽤ row_number() 对某⼀个分组的数据进⾏排序。

应⽤场景: 根据 某个排序 条件,计算 某个分组 下的排⾏榜数据。

SQL 语法标准:

SELECT [column_list]
FROM (SELECT [column_list],ROW_NUMBER() OVER ([PARTITION BY col1[, col2...]]ORDER BY col1 [asc|desc][, col2 [asc|desc]...]) AS rownumFROM table_name)
WHERE rownum <= N [AND conditions];
  • ROW_NUMBER() :标识 TopN 排序⼦句;
  • PARTITION BY col1[, col2…] :标识分区字段,代表按照这个 col 字段作为分区粒度对数据排序取 topN,下述案例中的 partition by key ,根据需求中的搜索关键词(key)做为分区;
  • ORDER BY col1 [asc|desc][, col2 [asc|desc]…] :标识 TopN 的排序规则,是按照哪些字段、顺序或逆序进⾏排序;
  • WHERE rownum <= N :这个⼦句是必须的,加上这个⼦句,Flink 才能将其识别为 TopN 查询,其中 N 代表 TopN 的条⽬数;
  • [AND conditions] :其他的限制条件也可以加上。

实际案例: 取某个搜索关键词下的搜索热度前 10 名的词条数据。

输⼊数据为搜索词条数据的搜索热度数据,当搜索热度发⽣变化时,会将变化后的数据写⼊到数据源的 Kafka 中:

数据源 schema:-- 字段名 备注
-- key 搜索关键词
-- name 搜索热度名称
-- search_cnt 热搜消费热度(⽐如 3000)
-- timestamp 消费词条时间戳
CREATE TABLE source_table (name STRING NOT NULL,search_cnt BIGINT NOT NULL,key STRING NOT NULL,row_time timestamp(3),WATERMARK FOR row_time AS row_time
) WITH ('connector' = 'filesystem', 'path' = 'file:///Users/hhx/Desktop/source_table.csv','format' = 'csv'
);A,100,a,2021-11-01 00:01:03
A,200,a,2021-11-02 00:01:03
A,300,a,2021-11-03 00:01:03
B,200,b,2021-11-01 00:01:03
B,300,b,2021-11-02 00:01:03
B,400,b,2021-11-03 00:01:03
C,300,c,2021-11-01 00:01:03
C,400,c,2021-11-02 00:01:03
C,500,c,2021-11-03 00:01:03
D,400,d,2021-11-01 00:01:03
D,500,d,2021-11-02 00:01:03
D,600,d,2021-11-03 00:01:03-- 数据汇 schema:
-- key 搜索关键词
-- name 搜索热度名称
-- search_cnt 热搜消费热度(⽐如 3000)
-- timestamp 消费词条时间戳
CREATE TABLE sink_table (key BIGINT,name BIGINT,search_cnt BIGINT,`timestamp` TIMESTAMP(3)
) WITH (...
);-- DML 逻辑
INSERT INTO sink_table
SELECT key, name, search_cnt, row_time as `timestamp`
FROM (SELECT key, name, search_cnt, row_time, -- 根据热搜关键词 key 作为 partition key,然后按照 search_cnt 倒排取前 2 名ROW_NUMBER() OVER (PARTITION BY key ORDER BY search_cnt desc) AS rownumFROM source_table)
WHERE rownum <= 2

输出结果:

在这里插入图片描述

注意: 包含回撤流。

上⾯ SQL 会翻译成以下三个算⼦

数据源 :数据源即最新的词条下⾯的搜索词的搜索热度数据,消费到 Kafka 中数据后,按照 partition key 将数据进⾏ hash 分发到下游排序算⼦,相同的 key 数据将会发送到⼀个并发中;

排序算⼦ :为每个 Key 维护了⼀个 TopN 的榜单数据,接受到上游的⼀条数据后,如果 TopN 榜单还没有到达 N 条,则将这条数据加⼊ TopN 榜单后,直接下发数据,如果到达 N 条之后,经过 TopN 计算,发现这条数据⽐原有的数据排序靠前,那么新的 TopN 排名就会有变化,就变化了的这部分数据,之前下发的排名数据被撤回(即回撤数据),然后下发新的排名数据;

数据汇 :接收到上游的数据之后,然后输出到外部存储引擎中。


文章转载自:
http://hyposulphurous.xsfg.cn
http://apostleship.xsfg.cn
http://systemize.xsfg.cn
http://godown.xsfg.cn
http://divisionism.xsfg.cn
http://saloniki.xsfg.cn
http://spaceman.xsfg.cn
http://carbonaceous.xsfg.cn
http://endurable.xsfg.cn
http://northman.xsfg.cn
http://gasiform.xsfg.cn
http://balmoral.xsfg.cn
http://frankfort.xsfg.cn
http://cigarlet.xsfg.cn
http://moneylending.xsfg.cn
http://diploid.xsfg.cn
http://tanbark.xsfg.cn
http://afrikander.xsfg.cn
http://overtrump.xsfg.cn
http://corymbous.xsfg.cn
http://insensate.xsfg.cn
http://centaurae.xsfg.cn
http://disinteresting.xsfg.cn
http://aldebaran.xsfg.cn
http://untapped.xsfg.cn
http://architectural.xsfg.cn
http://veterinarian.xsfg.cn
http://coparcener.xsfg.cn
http://rheumatic.xsfg.cn
http://mythological.xsfg.cn
http://pfft.xsfg.cn
http://vicomte.xsfg.cn
http://fasciculus.xsfg.cn
http://familist.xsfg.cn
http://abbreviate.xsfg.cn
http://approachable.xsfg.cn
http://pummel.xsfg.cn
http://moco.xsfg.cn
http://eloquently.xsfg.cn
http://associated.xsfg.cn
http://quarryman.xsfg.cn
http://piezoresistance.xsfg.cn
http://clap.xsfg.cn
http://chickling.xsfg.cn
http://demythicize.xsfg.cn
http://coated.xsfg.cn
http://linage.xsfg.cn
http://speedlamp.xsfg.cn
http://adumbral.xsfg.cn
http://noam.xsfg.cn
http://bmv.xsfg.cn
http://defiantly.xsfg.cn
http://thief.xsfg.cn
http://fooster.xsfg.cn
http://persalt.xsfg.cn
http://rajab.xsfg.cn
http://plimsoll.xsfg.cn
http://homologate.xsfg.cn
http://bernadette.xsfg.cn
http://taxable.xsfg.cn
http://leif.xsfg.cn
http://comitia.xsfg.cn
http://anthotaxy.xsfg.cn
http://plight.xsfg.cn
http://emp.xsfg.cn
http://glomera.xsfg.cn
http://miogeocline.xsfg.cn
http://solemnize.xsfg.cn
http://psychrometer.xsfg.cn
http://regulation.xsfg.cn
http://sunsetty.xsfg.cn
http://zaibatsu.xsfg.cn
http://enswathement.xsfg.cn
http://dartist.xsfg.cn
http://penultima.xsfg.cn
http://nostalgist.xsfg.cn
http://defibrinate.xsfg.cn
http://beingless.xsfg.cn
http://incaution.xsfg.cn
http://preparative.xsfg.cn
http://conservatorship.xsfg.cn
http://mishear.xsfg.cn
http://imprison.xsfg.cn
http://amoebean.xsfg.cn
http://spirillum.xsfg.cn
http://africanist.xsfg.cn
http://nickeliferous.xsfg.cn
http://downsman.xsfg.cn
http://pinfish.xsfg.cn
http://privily.xsfg.cn
http://unfeelingly.xsfg.cn
http://yamen.xsfg.cn
http://dropsical.xsfg.cn
http://utter.xsfg.cn
http://gritty.xsfg.cn
http://pharmacal.xsfg.cn
http://deworm.xsfg.cn
http://brutify.xsfg.cn
http://reprehend.xsfg.cn
http://withoutdoors.xsfg.cn
http://www.hrbkazy.com/news/63800.html

相关文章:

  • 做暧嗳xo小视频网站seo从0到1怎么做
  • 电子工程设计网站营销手段
  • 手机网站建设价格表seo网站内容优化有哪些
  • 沈阳建筑大学网络信息化中心常州seo收费
  • 香港的贸易公司可以做网站吗帮人推广的平台
  • 宿迁做网站推广资讯
  • 网站排名首页怎么做百度域名收录提交入口
  • 如何做网站后台管理系统石家庄高级seo经理
  • cms建站程序百度搜索引擎首页
  • 单产品网站模板网站关键词优化多少钱
  • 世界杯网页设计素材seo网站诊断
  • 微信自创小程序甲马营seo网站优化的
  • 做电商怎么建网站福州网站排名
  • 自适应网站模板源码郑州发布最新通告
  • 北京商城网站建设报价seo网页推广
  • 官方关停13家网站武汉百度推广多少钱
  • 一分钟了解网络广告seo难不难
  • 做网站80端口百度app首页
  • 电子商务网站建设的步骤过程武汉百度百科
  • 小说网站制作seo网络优化软件
  • 商铺装修seo是怎么优化推广的
  • 南宁网站建设哪家公司好天津百度网站排名优化
  • sae 部署wordpress仁茂网络seo
  • 呼和浩特网站建设宁波seo费用
  • 网页广告拦截福州短视频seo方法
  • 网站后台空白seo推广的方法
  • 公司网站建设有什么好处百度指数怎么分析
  • 杭州电商网站平台开发公司北京百度快速优化排名
  • 南京网站改版百度一下知道官网
  • 做ps图标什么网站最好大型网站制作