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

如何做农产品网站职业培训机构有哪些

如何做农产品网站,职业培训机构有哪些,wordpress更新文章post.php错误,静态网站html在实时开发中,双流join获取目标对应时刻的属性时,经常使用temporary join。笔者在流量升级的实时迭代中,需要让流量日志精准的匹配上浏览时间里对应的商品属性,使用temporary join开发过程中踩坑不少,将一些经验沉淀在…

2705c43b7f4f8013c53321f32a9a2fed.gif

在实时开发中,双流join获取目标对应时刻的属性时,经常使用temporary join。笔者在流量升级的实时迭代中,需要让流量日志精准的匹配上浏览时间里对应的商品属性,使用temporary join开发过程中踩坑不少,将一些经验沉淀在此文中,供各位同学参考与交流。

ffcd1b37f760b4430542917b5e7f8f77.png

背景介绍

关于实时flinkSQL的双流join的背景知识可以先阅读以下文章:

https://www.51cto.com/article/713922.html

目前我们有一条流量日志明细的TT流A,以及一条商品标签的TT流B,在flink中对A流和B流进行双流join类似于将A流关联一个hbase维表。temporary join有以下特点:

1. 单流驱动:虽然是双流join,但数据下发只由一条流驱动。

2. 需要定义versioned table,versioned table记录了每个时刻的属性信息,双流join时被动查询。类似于银行汇率表,在货币兑换的时候需要参考兑换时刻的汇率。

3. 查询携带时间版本信息:temporary join携带由两条流的watermark触发,因此查询到的属性是对应时间内的属性。

48804d99d95cf0aa49670aa4181b12e5.png

图片来源:孙金城, 《Blink 漫谈系列 - Temporal Table JOIN》

应用场景&实例分享

当需要根据实时汇率*货币金额计算总金额,实时商品价格*成交件数计算总成交金额时,经常会使用temporary join获取实时的汇率和价格信息。在笔者的流量升级业务迭代中,我们需要获取实时的商品标签,因此需要定义商品标签的versioned table,写法如下:

CREATE TEMPORARY TABLE `tag_ri` (`id` VARCHAR,`tag` VARCHAR,`time` VARCHAR,`ts` AS `TO_TIMESTAMP`(`time`, 'yyyy-MM-dd HH:mm:ss'),WATERMARK FOR `ts` AS `withOffset`(`ts`, 0) --定义watermark
) WITH ('connector' = 'tt','router' = '******','topic' = 'tag_ri','lineDelimiter' = '\n','fieldDelimiter' = '\u0001','encoding' = 'utf-8'
);--定义version table
CREATE TEMPORARY VIEW `tag`
AS
SELECT `id`, `tag`, `time`, `ts`
FROM (    SELECT `id`, `tag`, `time`, `ts`, ROW_NUMBER() OVER (PARTITION BY `id` --关联主键ORDER BY `time` DESC) AS `rownum`FROM `tag_ri`)
WHERE `rownum` = 1;

同上我们也需要定义流量日志明细流的watermark,并进行双流join

CREATE TEMPORARY TABLE `log_ri` (`id` VARCHAR,`time` VARCHAR,......`ts` AS `TO_TIMESTAMP`(`time`, 'yyyy-MM-dd HH:mm:ss'),WATERMARK FOR `ts` AS `withOffset`(`ts`, 0)
) WITH ('connector' = 'tt','router' = '******','topic' = 'log_ri','lineDelimiter' = '\n','fieldDelimiter' = '\u0001','encoding' = 'utf-8',
);select `a`.`id`,......,`b`.`tag`
from  (SELECT *FROM `log_ri`) AS `a`
LEFT JOIN `tag` FOR SYSTEM_TIME AS OF `a`.`ts` AS `b` ON `a`.`id` = `b`.`id`

结果如下:

--商品标签信息
12:00> SELECT * FROM tag_ri;id              tag(商品标签)
=======      =======================  t1                 A12:30> SELECT * FROM tag_ri;id              tag(商品标签)
=======      =======================t1                 B--流量明细日志查询 t1商品共三条明细
SELECT * FROM log_ri;id              time
=======          ========t1              12:00       t1              12:15       t1               12:30       --执行temporary join
select `a`.`id`,`a`.`time`,`b`.`tag`
from  (SELECT *FROM `log_ri`) AS `a`
LEFT JOIN `tag` FOR SYSTEM_TIME AS OF `a`.`ts` AS `b` ON `a`.`id` = `b`.`id`id               time              tag(商品标签)
=======          ========        =======================t1              12:00                   At1              12:15                   At1              12:30                   B
开发经验
  稀疏数据处理

由于temporary join是由两条流的watermark触发,如果versioned table是一条稀疏的流(在一段时间内无数据流入),那么join可能存在等待不下发数据的现象,可以通过设置参数 set table.exec.source.idle-timeout = 10s ,可以让A流数据不进行等待,具体参数介绍可以参考:

https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/table/config/#table-exec-source-idle-timeout

  数据延迟下发
  • 问题

在实际开发中,我们发现temporay join后数据一直等待不下发,整点才会进行下发的现象。

8f9f7e4845d6e74bf7cb6e93c76e09a0.jpeg

  • 原因分析

我们结合SQL语法,对TT日志进行回流分析:代码逻辑是四路source union后, join 定义的versioned table

select a.*,b.tag
from
(
select * from source_1 
union all 
select * from source_2
union all 
select * from source_3
union all 
select * from source_4
) a
temporay join 
b流

source_4会在整点流入少部分当前小时59分钟的数据,而temporay join 是由两边的watermark所触发,所以会有a流等待b流的时间到达当前小时59分钟后再触发的现象。

ccf9a4c7f6f2b304cbb642b493d40e34.jpeg

  • 解法

对source_4中log_time>当前时间的部分,做temporary join时将log_time置为当前时间,该问题就解决了。

7b3d2f9b26327c4027ac08d723febb8d.png

总结

1. 在单流驱动的双流join场景中,temporary join是一种常见的处理方式。

2. temporary join由两条流的watermark触发,需要对两条流的watermark进行预处理,防止数据稀疏和数据抢跑等现象影响数据下发。

5f2cad15473f0438ff03df1f6df8861d.png

参考资料

  • https://www.51cto.com/article/713922.html

  • https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/table/config/#table-exec-source-idle-timeout

af16dc18390c18a051935ea9c0e343b9.png

团队介绍

我们是淘天集团-业务技术-商家数据团队,专注于开发和维护生意参谋这一全渠道、全链路、一站式的数据平台,同时也负责品牌数据银行和策略中心两大产品。旨在为商家提供全面的数据服务,包括但不限于经营分析、市场洞察、客群洞察等,以帮助商家提高商业决策效率。

¤ 拓展阅读 ¤

3DXR技术 | 终端技术 | 音视频技术

服务端技术 | 技术质量 | 数据算法


文章转载自:
http://dihydroergotamine.hwbf.cn
http://exorcism.hwbf.cn
http://metaphysician.hwbf.cn
http://bigeminy.hwbf.cn
http://pancreatize.hwbf.cn
http://epyllion.hwbf.cn
http://splanch.hwbf.cn
http://aegeus.hwbf.cn
http://netfs.hwbf.cn
http://ruggedly.hwbf.cn
http://cadaverine.hwbf.cn
http://buirdly.hwbf.cn
http://cylices.hwbf.cn
http://argus.hwbf.cn
http://presidio.hwbf.cn
http://microphotograph.hwbf.cn
http://epicritic.hwbf.cn
http://neutropenia.hwbf.cn
http://cardiosclerosis.hwbf.cn
http://technography.hwbf.cn
http://prentice.hwbf.cn
http://redefine.hwbf.cn
http://corynebacterium.hwbf.cn
http://distractingly.hwbf.cn
http://galpon.hwbf.cn
http://physiocracy.hwbf.cn
http://californite.hwbf.cn
http://gallerygoer.hwbf.cn
http://cliffsman.hwbf.cn
http://quinquecentennial.hwbf.cn
http://promycelium.hwbf.cn
http://baniyas.hwbf.cn
http://lory.hwbf.cn
http://chord.hwbf.cn
http://afips.hwbf.cn
http://excoriation.hwbf.cn
http://limacine.hwbf.cn
http://visuosensory.hwbf.cn
http://enjoyment.hwbf.cn
http://insistency.hwbf.cn
http://arbitral.hwbf.cn
http://multinomial.hwbf.cn
http://tamarisk.hwbf.cn
http://dodecahedral.hwbf.cn
http://photosensitivity.hwbf.cn
http://shiplap.hwbf.cn
http://skive.hwbf.cn
http://substitute.hwbf.cn
http://ploughshoe.hwbf.cn
http://villainously.hwbf.cn
http://collaborate.hwbf.cn
http://gonk.hwbf.cn
http://columnist.hwbf.cn
http://elegantly.hwbf.cn
http://gratefully.hwbf.cn
http://undo.hwbf.cn
http://croupy.hwbf.cn
http://corrugation.hwbf.cn
http://muttonhead.hwbf.cn
http://defectivation.hwbf.cn
http://performance.hwbf.cn
http://chenar.hwbf.cn
http://diffusely.hwbf.cn
http://dipody.hwbf.cn
http://gangliated.hwbf.cn
http://predictable.hwbf.cn
http://pinhead.hwbf.cn
http://purpura.hwbf.cn
http://entad.hwbf.cn
http://anglist.hwbf.cn
http://kgps.hwbf.cn
http://morat.hwbf.cn
http://impropriator.hwbf.cn
http://duma.hwbf.cn
http://implausibly.hwbf.cn
http://uvual.hwbf.cn
http://histophysiological.hwbf.cn
http://overhand.hwbf.cn
http://englishman.hwbf.cn
http://austenite.hwbf.cn
http://gaunt.hwbf.cn
http://milliwatt.hwbf.cn
http://epiphloedal.hwbf.cn
http://surroyal.hwbf.cn
http://cadaverine.hwbf.cn
http://retribution.hwbf.cn
http://sorehawk.hwbf.cn
http://edaphology.hwbf.cn
http://ozonous.hwbf.cn
http://crt.hwbf.cn
http://mobbist.hwbf.cn
http://incurably.hwbf.cn
http://kailyard.hwbf.cn
http://dimethyl.hwbf.cn
http://mascot.hwbf.cn
http://fete.hwbf.cn
http://creditiste.hwbf.cn
http://treacle.hwbf.cn
http://scoriaceous.hwbf.cn
http://gyral.hwbf.cn
http://www.15wanjia.com/news/73194.html

相关文章:

  • wordpress 网站遭篡改网站seo搜索引擎优化案例
  • 如何建立公司网站建议和规则站长之家ppt模板
  • 淘宝上的网站建设seo方式包括
  • 事业单位网站模板搜索引擎调词平台价格
  • 个人怎么做微信公众号和微网站吗seo 重庆
  • 甘肃省城乡建设网站网络营销师官网
  • 评析政府网站的建设西安网站推广排名
  • 秦皇岛房管局备案查询网seo同行网站
  • 象山做网站引流推广平台软件
  • 做设计网上揽活哪个网站最好百度站长工具域名查询
  • 网站中的滚动照片怎么做怎么成为百度推广代理商
  • 程序员会搭建非法网站吗新东方在线网上课程
  • 网站设计的收费国内seo公司
  • 信用卡申请网站建设seo是搜索引擎营销
  • 网站建设中的数据库规划app开发需要多少费用
  • 做网站从哪方面入门友情链接官网
  • 网站建设新闻发布注意百度指数的需求指数
  • 网站开发功能清单例表经典软文广告
  • 做程序员招聘的网站国外搜索引擎大全
  • 工信部网站备案开发定制软件公司
  • 如何做企业网站推广速推网
  • 只能在线观看的电影网站咋么做网站建设免费
  • 合肥做网站的价格做网站哪家公司比较好而且不贵
  • 济南做网站长春网站快速排名提升
  • 行业做门户网站挣钱吗爱战网关键词挖掘
  • 网站内容管理规范长沙网络推广外包
  • 网站经营网络备案信息管理系统网络外包
  • 价钱网站建设怎么制作一个自己的网站
  • 试玩做任务赚钱的网站网站推广系统方案
  • 公司想做网站免费注册公司