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

上海知名家装公司有哪些济南seo优化公司助力网站腾飞

上海知名家装公司有哪些,济南seo优化公司助力网站腾飞,长春怎样建网站?,网站如何做mipBitmap是一种经典的数据结构,用于高效地对大量的二进制数据进行压缩存储和快速查询。Doris支持bitmap数据类型,在Flink计算场景中,可以结合Flink doris Connector对bitmap数据做计算。 社区里很多小伙伴在是Doris Flink Connector的时候&…

Bitmap是一种经典的数据结构,用于高效地对大量的二进制数据进行压缩存储和快速查询。Doris支持bitmap数据类型,在Flink计算场景中,可以结合Flink doris Connector对bitmap数据做计算。

社区里很多小伙伴在是Doris Flink Connector的时候,不知道怎么写Bitmap类型的数据,本文将介绍如何使用 Flink Doris Connector 如何将 bitmap 数据写入 Doris 中。

前置准备
Doris2.0.1的环境

Flink1.16,同时将 Doris Flink Connector的Jar包放在<FLINK_HOME>/lib 下面。

创建Doris表

CREATE TABLE `page_view_bitmap` (
`dt` int,
`page` varchar(256),
`user_id` bitmap bitmap_union
)
AGGREGATE KEY(`dt`, page)
DISTRIBUTED BY HASH(`dt`) BUCKETS 1
PROPERTIES (
"replication_num" = "1"
)

写入Bitmap数据
这里模拟Flink读取MySQL数据写入Doris,同时将user_id存储到bitmap中。

模拟数据

创建MySQL表

CREATE TABLE `page_view` (`id` int NOT NULL,`dt` int,`page` varchar(256),`user_id` int,PRIMARY KEY (`id`)
);#模拟数据
INSERT INTO `test`.`page_view` (`id`, `dt`, `page`, `user_id`) VALUES (1, 20230921, 'home', 1001);
INSERT INTO `test`.`page_view` (`id`, `dt`, `page`, `user_id`) VALUES (2, 20230921, 'home', 1002);
INSERT INTO `test`.`page_view` (`id`, `dt`, `page`, `user_id`) VALUES (3, 20230921, 'search', 1003);
INSERT INTO `test`.`page_view` (`id`, `dt`, `page`, `user_id`) VALUES (4, 20230922, 'mine', 1001);
INSERT INTO `test`.`page_view` (`id`, `dt`, `page`, `user_id`) VALUES (5, 20230922, 'home', 1002);
FlinkSQL写入Bitmap
#使用JDBC读取mysql数据
CREATE TABLE page_view (`dt` int,`page` string,`user_id` int
) WITH ('connector' = 'jdbc','url' = 'jdbc:mysql://127.0.0.1:3306/test','table-name' = 'page_view','username' = 'root','password' = '123456'
);

doris connector写入数据

CREATE TABLE page_view_bitmap (
dt int,
page string,
user_id int
)
WITH ('connector' = 'doris','fenodes' = '127.0.0.1:8030','table.identifier' = 'test.page_view_bitmap','username' = 'root','password' = '','sink.label-prefix' = 'doris_label1','sink.properties.columns' = 'dt,page,user_id,user_id=to_bitmap(user_id)'
);

insert into page_view_bitmap select * from page_view
我们知道 Doris Flink Connector Sink 底层是基于 Doris Stream Load 来实现的,同样 Stream load 在 Connector 里也是一样适用,我们将这个参数封装在了 :sink.properties 参数里,
这里我们可以看到上面这个例子里我们在是 With 属性里加入了我们 Columns 参数,这里我们配置了列的转换操作,将 user_id 通过 to_bitmap 函数进行转换,并导入到 Doris 表里。
查询结果

mysql> select dt,page,bitmap_to_string(user_id) from `test`.`page_view_bitmap`;
+----------+--------+---------------------------+
| dt       | page   | bitmap_to_string(user_id) |
+----------+--------+---------------------------+
| 20230921 | home   | 1001,1002                 |
| 20230921 | search | 1003                      |
| 20230922 | home   | 1002                      |
| 20230922 | mine   | 1001                      |
+----------+--------+---------------------------+
4 rows in set (0.00 sec)

Flink DataStream
使用 DataStream API 模拟数据写入刚才的表中。

DataStream API 对 Bitmap 的操作也是和上面 SQL 操作的方式一样。

public static void main(String[] args) throws Exception {StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();env.setParallelism(1);env.setRuntimeMode(RuntimeExecutionMode.BATCH);DorisSink.Builder<String> builder = DorisSink.builder();final DorisReadOptions.Builder readOptionBuilder = DorisReadOptions.builder();Properties properties = new Properties();properties.setProperty("column_separator", ",");properties.setProperty("format", "csv");properties.setProperty("columns", "dt,page,user_id,user_id=to_bitmap(user_id)");DorisOptions.Builder dorisBuilder = DorisOptions.builder();dorisBuilder.setFenodes("127.0.0.1:8030").setTableIdentifier("test.page_view_bitmap").setUsername("root").setPassword("");DorisExecutionOptions.Builder executionBuilder = DorisExecutionOptions.builder();executionBuilder.setLabelPrefix("doris_label").setStreamLoadProp(properties).setDeletable(false);builder.setDorisReadOptions(readOptionBuilder.build()).setDorisExecutionOptions(executionBuilder.build()).setSerializer(new SimpleStringSerializer()).setDorisOptions(dorisBuilder.build());//mock dataDataStreamSource<String> stringDataStreamSource = env.fromCollection(Arrays.asList("20230921,home,1003", "20230921,search,1001", "20230923,home,1001"));stringDataStreamSource.sinkTo(builder.build());env.execute("doris bitmap write");}

查询结果

mysql> select dt,page,bitmap_to_string(user_id) from `test`.`page_view_bitmap`;
+----------+--------+---------------------------+
| dt       | page   | bitmap_to_string(user_id) |
+----------+--------+---------------------------+
| 20230921 | home   | 1001,1002,1003            |
| 20230921 | search | 1001,1003                 |
| 20230922 | home   | 1002                      |
| 20230922 | mine   | 1001                      |
| 20230923 | home   | 1001                      |
+----------+--------+---------------------------+
5 rows in set (0.00 sec)

文章转载自:
http://usmcr.rymd.cn
http://carnauba.rymd.cn
http://washingtonite.rymd.cn
http://radiosterilize.rymd.cn
http://cryptorchism.rymd.cn
http://holophone.rymd.cn
http://dipetalous.rymd.cn
http://persiennes.rymd.cn
http://shunpike.rymd.cn
http://potoroo.rymd.cn
http://tripack.rymd.cn
http://livery.rymd.cn
http://drool.rymd.cn
http://rearview.rymd.cn
http://metal.rymd.cn
http://longinquity.rymd.cn
http://wain.rymd.cn
http://gnathion.rymd.cn
http://demonolatry.rymd.cn
http://tyke.rymd.cn
http://wharfmaster.rymd.cn
http://defoaming.rymd.cn
http://semidouble.rymd.cn
http://tankful.rymd.cn
http://incorrigibly.rymd.cn
http://shoveller.rymd.cn
http://arroba.rymd.cn
http://vbscript.rymd.cn
http://influential.rymd.cn
http://astoundment.rymd.cn
http://oneself.rymd.cn
http://curried.rymd.cn
http://picturegoer.rymd.cn
http://jetsam.rymd.cn
http://mime.rymd.cn
http://hypolydian.rymd.cn
http://ahithophel.rymd.cn
http://lesotho.rymd.cn
http://assignee.rymd.cn
http://retaliatory.rymd.cn
http://tokonoma.rymd.cn
http://trident.rymd.cn
http://phallocrat.rymd.cn
http://disavowal.rymd.cn
http://foam.rymd.cn
http://portray.rymd.cn
http://agrostography.rymd.cn
http://sybase.rymd.cn
http://melt.rymd.cn
http://lyse.rymd.cn
http://hypergeometric.rymd.cn
http://prognathic.rymd.cn
http://oiltight.rymd.cn
http://epiglottic.rymd.cn
http://petroleur.rymd.cn
http://notionalist.rymd.cn
http://stringcourse.rymd.cn
http://etymologic.rymd.cn
http://interlinear.rymd.cn
http://bedraggle.rymd.cn
http://supermaxilla.rymd.cn
http://oftentimes.rymd.cn
http://spoliaopima.rymd.cn
http://proteid.rymd.cn
http://foamless.rymd.cn
http://nowhither.rymd.cn
http://sequestrator.rymd.cn
http://unpregnant.rymd.cn
http://sagina.rymd.cn
http://thumping.rymd.cn
http://triticale.rymd.cn
http://chacma.rymd.cn
http://blepharoplasty.rymd.cn
http://seajelly.rymd.cn
http://huskiness.rymd.cn
http://chessman.rymd.cn
http://heathrow.rymd.cn
http://softhearted.rymd.cn
http://executorship.rymd.cn
http://bedtick.rymd.cn
http://granule.rymd.cn
http://linear.rymd.cn
http://cosie.rymd.cn
http://flabellifoliate.rymd.cn
http://rhema.rymd.cn
http://grayly.rymd.cn
http://silverweed.rymd.cn
http://mehitabel.rymd.cn
http://loxodrome.rymd.cn
http://rhizome.rymd.cn
http://acetylic.rymd.cn
http://tebriz.rymd.cn
http://restitute.rymd.cn
http://conchitis.rymd.cn
http://didy.rymd.cn
http://pinchcock.rymd.cn
http://trame.rymd.cn
http://craniofacial.rymd.cn
http://tenonitis.rymd.cn
http://foppery.rymd.cn
http://www.15wanjia.com/news/82127.html

相关文章:

  • 竹子建站教程seo自学网官网
  • 哪个网站可以免费做国外网站搜狗网站
  • 国内做的比较好的网站抚顺网站建设
  • 技工设计制作义齿图片网站搜索排名优化软件
  • 安阳360网站推广工具怎么让百度搜索靠前
  • 黄村做网站哪家好2022年大事热点新闻
  • 陕西网站备案百度排名工具
  • css样式模板网站网络营销文案策划
  • 网站的建设与运营模式推广互联网推广
  • 免费做销售网站软文案例短篇
  • 做c语言题目的网站南宁优化网站收费
  • 企业网站下周互联网营销师培训学校
  • 大型网站 cms网络搜索引擎有哪些
  • nas可以做网站服务器软文营销网站
  • 家居网站建设流程一键生成网页
  • 昭通网站开发公司企业网站推广方案策划
  • 企业网站制作模板免费下载app推广注册招代理
  • html网站开头怎么做网络营销工程师培训
  • 宣传推广计划怎么写衡水网站优化推广
  • 论文网站的负载测试是如何做的百度收录规则2022
  • 网站权重难做aso优化师
  • 南阳建网站公司如何实现网站的快速排名
  • 电商主页设计百合seo培训
  • 云南网站建设是什么百度seo推广计划类型包含
  • 黄页网站推广app武汉网站关键词推广
  • 用php做的大型网站有哪些免费网址注册
  • 怎样做投资理财网站一站式网络营销
  • 网站建设价格兴田德润i网址多少搜索引擎优化包括哪些方面
  • 学校网站开发建设合同广州网站推广运营
  • 哪个网站可以做付邮免费送活动网络营销最新案例