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

长沙做网站建设公司哪家好营销客户管理系统

长沙做网站建设公司哪家好,营销客户管理系统,房地产做网站的意义,做一个自己的app要多少钱一、目的 在完成数据之后对业务指标进行分析,Hive和ClickHouseSQL真不一样 二、部分业务指标表 2.1 统计数据流量表1天周期 2.1.1 Hive中原有代码 2.1.1.1 Hive中建表语句 --1、统计数据流量表——动态分区——1天周期 create table if not exists hurys_d…

一、目的

在完成数据之后对业务指标进行分析,Hive和ClickHouseSQL真不一样

二、部分业务指标表

2.1 统计数据流量表1天周期

2.1.1 Hive中原有代码

2.1.1.1 Hive中建表语句
--1、统计数据流量表——动态分区——1天周期
create  table  if not exists  hurys_db.dws_statistics_volume_1day(device_no        string         comment '设备编号',scene_name       string         comment '场景名称',lane_no          int            comment '车道编号',lane_direction   string         comment '车道流向',section_no       int            comment '断面编号',device_direction string         comment '雷达朝向',sum_volume_day   int            comment '每天总流量',week_day         string         comment '周几',month            string         comment '月份'
)
comment '统计数据流量表——动态分区——1天周期'
partitioned by (day string)
stored as orc
;
2.1.1.2 Hive中SQL语句
--动态加载数据
insert  overwrite  table  hurys_db.dws_statistics_volume_1day  partition(day)
selectdwd_st.device_no,dwd_sc.scene_name,dwd_st.lane_no,dwd_rl.lane_direction,dwd_st.section_no,dwd_rc.device_direction,sum(volume_sum) sum_volume_day,case when pmod(datediff(create_time,'2023-11-27') + 1,7) = 1 then '周一'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 2 then '周二'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 3 then '周三'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 4 then '周四'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 5 then '周五'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 6 then '周六'else '周日' end as week_day,substr(day,1,7) month,day
from hurys_db.dwd_statistics as dwd_stright join hurys_db.dwd_radar_lane as dwd_rlon dwd_rl.device_no=dwd_st.device_no and dwd_rl.lane_no=dwd_st.lane_noright join hurys_db.dwd_device_scene as dwd_dson dwd_ds.device_no=dwd_st.device_noright join hurys_db.dwd_scene as dwd_scon dwd_sc.scene_id = dwd_ds.scene_idright join hurys_db.dwd_radar_config as dwd_rcon dwd_rc.device_no=dwd_st.device_no
where dwd_st.create_time is not null   and   dwd_st.day='2024-09-05'
group by dwd_st.device_no, dwd_sc.scene_name, dwd_st.lane_no, dwd_rl.lane_direction, dwd_st.section_no, dwd_rc.device_direction, case when pmod(datediff(create_time,'2023-11-27') + 1,7) = 1 then '周一'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 2 then '周二'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 3 then '周三'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 4 then '周四'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 5 then '周五'when pmod(datediff(create_time,'2023-11-27') + 1,7) = 6 then '周六'else '周日' end, day
;

2.1.2 ClickHouse中现有代码

2.1.2.1 ClickHouse中表结构
--1、统计数据流量表——动态分区——1天周期
create  table  if not exists  hurys_jw.dws_statistics_volume_1day(device_no        String                   comment '设备编号',scene_name       String                   comment '场景名称',lane_no          Nullable(Int32)          comment '车道编号',lane_direction   Nullable(String)         comment '车道流向',section_no       Nullable(Int32)          comment '断面编号',device_direction Nullable(String)         comment '雷达朝向',sum_volume_day   Nullable(Int32)          comment '每天总流量',week_day         Nullable(String)         comment '周几',month            Nullable(String)         comment '月份',day              Date                    comment '日期'
)
ENGINE = MergeTree
PARTITION BY day
PRIMARY KEY day
ORDER BY day
SETTINGS index_granularity = 8192;
2.1.2.2 ClickHouse中SQL语句
--动态加载数据
selectdwd_st.device_no,dwd_sc.scene_name,dwd_st.lane_no,dwd_rl.lane_direction,dwd_st.section_no,dwd_rc.device_direction,sum(volume_sum) sum_volume_day,
       case when toDayOfWeek(create_time) = 1 then '周一'when toDayOfWeek(create_time) = 2 then '周二'when toDayOfWeek(create_time) = 3 then '周三'when toDayOfWeek(create_time) = 4 then '周四'when toDayOfWeek(create_time) = 5 then '周五'when toDayOfWeek(create_time) = 6 then '周六'when toDayOfWeek(create_time) = 7 then '周日'end as week_day,
    concat(toString(toYear(dwd_st.day)), '-', lpad(toString(toMonth(dwd_st.day)), 2, '0')) AS month,cast(dwd_st.day as String) day
from hurys_jw.dwd_statistics as dwd_stright join hurys_jw.dwd_radar_lane as dwd_rlon dwd_rl.device_no=dwd_st.device_no and dwd_rl.lane_no=dwd_st.lane_noright join hurys_jw.dwd_device_scene as dwd_dson dwd_ds.device_no=dwd_st.device_noright join hurys_jw.dwd_scene as dwd_scon dwd_sc.scene_id = dwd_ds.scene_idright join hurys_jw.dwd_radar_config as dwd_rcon dwd_rc.device_no=dwd_st.device_no
where dwd_st.create_time is not null and dwd_st.lane_no is not null  and   dwd_st.day >= ?
group by  dwd_st.device_no, dwd_sc.scene_name, dwd_st.lane_no, dwd_rl.lane_direction, dwd_st.section_no, dwd_rc.device_direction, case when toDayOfWeek(create_time) = 1 then '周一'when toDayOfWeek(create_time) = 2 then '周二'when toDayOfWeek(create_time) = 3 then '周三'when toDayOfWeek(create_time) = 4 then '周四'when toDayOfWeek(create_time) = 5 then '周五'when toDayOfWeek(create_time) = 6 then '周六'when toDayOfWeek(create_time) = 7 then '周日'end, dwd_st.day
;

2.2 统计数据流量表5分钟周期

2.2.1 Hive中原有代码

2.2.1.1 Hive中建表语句
--5、统计数据流量表——动态分区——5分钟周期
create  table  if not exists  hurys_db.dws_statistics_volume_5min(device_no        string         comment '设备编号',scene_name       string         comment '场景名称',lane_no          int            comment '车道编号',lane_direction   string         comment '车道流向',section_no       int            comment '断面编号',device_direction string         comment '雷达朝向',sum_volume_5min  int            comment '每5分钟总流量',start_time       timestamp      comment '开始时间'
)
comment '统计数据流量表——动态分区——5分钟周期'
partitioned by (day string)
stored as orc
;
2.2.1.2 Hive中SQL语句
--动态加载数据
insert  overwrite  table  hurys_db.dws_statistics_volume_5min  partition(day)
selectdwd_st.device_no,dwd_sc.scene_name,dwd_st.lane_no,dwd_rl.lane_direction,dwd_st.section_no,dwd_rc.device_direction,sum(volume_sum)   sum_volume_5min,case   when  minute(create_time ) < 5 thenconcat(substr(create_time, 1, 14), '00:00')when minute(create_time) >=5 and minute(create_time) <10 thenconcat(substr(create_time, 1, 14), '05:00')when minute(create_time) >=10 and minute(create_time) <15 thenconcat(substr(create_time, 1, 14), '10:00')when minute(create_time) >=15 and minute(create_time) <20 thenconcat(substr(create_time, 1, 14), '15:00')when minute(create_time) >=20 and minute(create_time) <25 thenconcat(substr(create_time, 1, 14), '20:00')when minute(create_time) >=25 and minute(create_time) <30 thenconcat(substr(create_time, 1, 14), '25:00')when minute(create_time) >=30 and minute(create_time) <35 thenconcat(substr(create_time, 1, 14), '30:00')when minute(create_time) >=35 and minute(create_time) <40 thenconcat(substr(create_time, 1, 14), '35:00')when minute(create_time) >=40 and minute(create_time) <45 thenconcat(substr(create_time, 1, 14), '40:00')when minute(create_time) >=45 and minute(create_time) <50 thenconcat(substr(create_time, 1, 14), '45:00')when minute(create_time) >=50 and minute(create_time) <55 thenconcat(substr(create_time, 1, 14), '50:00')elseconcat(substr(create_time, 1, 14), '55:00') end as start_time,day
from hurys_db.dwd_statistics as dwd_stright join hurys_db.dwd_radar_lane as dwd_rlon dwd_rl.device_no=dwd_st.device_no and dwd_rl.lane_no=dwd_st.lane_noright join hurys_db.dwd_device_scene as dwd_dson dwd_ds.device_no=dwd_st.device_noright join hurys_db.dwd_scene as dwd_scon dwd_sc.scene_id = dwd_ds.scene_idright join hurys_db.dwd_radar_config as dwd_rcon dwd_rc.device_no=dwd_st.device_no
where dwd_st.create_time is not null   and   dwd_st.day='2024-09-05'
group by dwd_st.device_no, dwd_sc.scene_name, dwd_st.lane_no, dwd_rl.lane_direction, dwd_st.section_no, dwd_rc.device_direction, case   when  minute(create_time ) < 5 thenconcat(substr(create_time, 1, 14), '00:00')when minute(create_time) >=5 and minute(create_time) <10 thenconcat(substr(create_time, 1, 14), '05:00')when minute(create_time) >=10 and minute(create_time) <15 thenconcat(substr(create_time, 1, 14), '10:00')when minute(create_time) >=15 and minute(create_time) <20 thenconcat(substr(create_time, 1, 14), '15:00')when minute(create_time) >=20 and minute(create_time) <25 thenconcat(substr(create_time, 1, 14), '20:00')when minute(create_time) >=25 and minute(create_time) <30 thenconcat(substr(create_time, 1, 14), '25:00')when minute(create_time) >=30 and minute(create_time) <35 thenconcat(substr(create_time, 1, 14), '30:00')when minute(create_time) >=35 and minute(create_time) <40 thenconcat(substr(create_time, 1, 14), '35:00')when minute(create_time) >=40 and minute(create_time) <45 thenconcat(substr(create_time, 1, 14), '40:00')when minute(create_time) >=45 and minute(create_time) <50 thenconcat(substr(create_time, 1, 14), '45:00')when minute(create_time) >=50 and minute(create_time) <55 thenconcat(substr(create_time, 1, 14), '50:00')elseconcat(substr(create_time, 1, 14), '55:00') end, day
;

2.2.2 ClickHouse中现有代码

2.2.2.1 ClickHouse中表结构
--5、统计数据流量表——动态分区——5分钟周期
create  table  if not exists  hurys_jw.dws_statistics_volume_5min(device_no        String                   comment '设备编号',scene_name       String                   comment '场景名称',lane_no          Nullable(Int32)          comment '车道编号',lane_direction   Nullable(String)         comment '车道流向',section_no       Nullable(Int32)          comment '断面编号',device_direction Nullable(String)         comment '雷达朝向',sum_volume_5min  Nullable(Int32)          comment '每5分钟总流量',start_time       DateTime                 comment '开始时间',day              Date                    comment '日期'
)
ENGINE = MergeTree
PARTITION BY day
PRIMARY KEY day
ORDER BY day
SETTINGS index_granularity = 8192;
2.2.2.2 ClickHouse中SQL语句
--动态加载数据
selectdwd_st.device_no,dwd_sc.scene_name,dwd_st.lane_no,dwd_rl.lane_direction,dwd_st.section_no,dwd_rc.device_direction,sum(volume_sum)   sum_volume_5min,
        toDateTime(concat(toString(toDate(create_time)),' ',lpad(toString(extract(hour FROM create_time)), 2, '0'),':',CASEWHEN extract(minute FROM create_time) < 5 THEN '00'WHEN extract(minute FROM create_time) >= 5 AND extract(minute FROM create_time) < 10 THEN '05'WHEN extract(minute FROM create_time) >= 10 AND extract(minute FROM create_time) < 15 THEN '10'WHEN extract(minute FROM create_time) >= 15 AND extract(minute FROM create_time) < 20 THEN '15'WHEN extract(minute FROM create_time) >= 20 AND extract(minute FROM create_time) < 25 THEN '20'WHEN extract(minute FROM create_time) >= 25 AND extract(minute FROM create_time) < 30 THEN '25'WHEN extract(minute FROM create_time) >= 30 AND extract(minute FROM create_time) < 35 THEN '30'WHEN extract(minute FROM create_time) >= 35 AND extract(minute FROM create_time) < 40 THEN '35'WHEN extract(minute FROM create_time) >= 40 AND extract(minute FROM create_time) < 45 THEN '40'WHEN extract(minute FROM create_time) >= 45 AND extract(minute FROM create_time) < 50 THEN '45'WHEN extract(minute FROM create_time) >= 50 AND extract(minute FROM create_time) < 55 THEN '50'ELSE '55'END,':00'))  as start_time,cast(dwd_st.day as String) day
from hurys_jw.dwd_statistics as dwd_stright join hurys_jw.dwd_radar_lane as dwd_rlon dwd_rl.device_no=dwd_st.device_no and dwd_rl.lane_no=dwd_st.lane_noright join hurys_jw.dwd_device_scene as dwd_dson dwd_ds.device_no=dwd_st.device_noright join hurys_jw.dwd_scene as dwd_scon dwd_sc.scene_id = dwd_ds.scene_idright join hurys_jw.dwd_radar_config as dwd_rcon dwd_rc.device_no=dwd_st.device_no
where dwd_st.create_time is not null   and  dwd_st.lane_no is not null   and   dwd_st.day >= ?
group by dwd_st.device_no, dwd_sc.scene_name, dwd_st.lane_no, dwd_rl.lane_direction, dwd_st.section_no, dwd_rc.device_direction, toDateTime(concat(toString(toDate(create_time)),' ',lpad(toString(extract(hour FROM create_time)), 2, '0'),':',CASEWHEN extract(minute FROM create_time) < 5 THEN '00'WHEN extract(minute FROM create_time) >= 5 AND extract(minute FROM create_time) < 10 THEN '05'WHEN extract(minute FROM create_time) >= 10 AND extract(minute FROM create_time) < 15 THEN '10'WHEN extract(minute FROM create_time) >= 15 AND extract(minute FROM create_time) < 20 THEN '15'WHEN extract(minute FROM create_time) >= 20 AND extract(minute FROM create_time) < 25 THEN '20'WHEN extract(minute FROM create_time) >= 25 AND extract(minute FROM create_time) < 30 THEN '25'WHEN extract(minute FROM create_time) >= 30 AND extract(minute FROM create_time) < 35 THEN '30'WHEN extract(minute FROM create_time) >= 35 AND extract(minute FROM create_time) < 40 THEN '35'WHEN extract(minute FROM create_time) >= 40 AND extract(minute FROM create_time) < 45 THEN '40'WHEN extract(minute FROM create_time) >= 45 AND extract(minute FROM create_time) < 50 THEN '45'WHEN extract(minute FROM create_time) >= 50 AND extract(minute FROM create_time) < 55 THEN '50'ELSE '55'END,':00')), cast(dwd_st.day as String)
;

就先这样,反正ClickHouse和Hive的SQL语句非常非常不一样!!!


文章转载自:
http://abundant.yrpg.cn
http://torsel.yrpg.cn
http://blush.yrpg.cn
http://salonika.yrpg.cn
http://tussah.yrpg.cn
http://ethyne.yrpg.cn
http://oscar.yrpg.cn
http://dulciana.yrpg.cn
http://oceanarium.yrpg.cn
http://downpour.yrpg.cn
http://hypokinetic.yrpg.cn
http://eftsoon.yrpg.cn
http://bolograph.yrpg.cn
http://gravid.yrpg.cn
http://hargeisa.yrpg.cn
http://unaptly.yrpg.cn
http://lunge.yrpg.cn
http://cism.yrpg.cn
http://atroceruleous.yrpg.cn
http://genospecies.yrpg.cn
http://seakeeping.yrpg.cn
http://ceaseless.yrpg.cn
http://samplesort.yrpg.cn
http://permissibly.yrpg.cn
http://rodman.yrpg.cn
http://adh.yrpg.cn
http://organa.yrpg.cn
http://hefei.yrpg.cn
http://abiding.yrpg.cn
http://debtee.yrpg.cn
http://reload.yrpg.cn
http://brandling.yrpg.cn
http://sharpen.yrpg.cn
http://naturalist.yrpg.cn
http://heterozygote.yrpg.cn
http://griminess.yrpg.cn
http://standpattism.yrpg.cn
http://hylotheism.yrpg.cn
http://reserpine.yrpg.cn
http://schmutz.yrpg.cn
http://emancipate.yrpg.cn
http://executant.yrpg.cn
http://embosom.yrpg.cn
http://meaningless.yrpg.cn
http://ghastly.yrpg.cn
http://cursorial.yrpg.cn
http://deaminize.yrpg.cn
http://cuneatic.yrpg.cn
http://desegregation.yrpg.cn
http://racial.yrpg.cn
http://perle.yrpg.cn
http://maladjustment.yrpg.cn
http://deaminase.yrpg.cn
http://thanatism.yrpg.cn
http://bequest.yrpg.cn
http://gnathism.yrpg.cn
http://moleskin.yrpg.cn
http://terrace.yrpg.cn
http://heiduc.yrpg.cn
http://fratchy.yrpg.cn
http://nephoscope.yrpg.cn
http://laical.yrpg.cn
http://stern.yrpg.cn
http://uppertendom.yrpg.cn
http://blove.yrpg.cn
http://streptomyces.yrpg.cn
http://anabolite.yrpg.cn
http://crossbowman.yrpg.cn
http://travois.yrpg.cn
http://monsveneris.yrpg.cn
http://extracellularly.yrpg.cn
http://typify.yrpg.cn
http://plastogamy.yrpg.cn
http://chateau.yrpg.cn
http://extralunar.yrpg.cn
http://polystyrene.yrpg.cn
http://coagulase.yrpg.cn
http://antler.yrpg.cn
http://estrade.yrpg.cn
http://supportable.yrpg.cn
http://thrombose.yrpg.cn
http://cryptogrammic.yrpg.cn
http://istria.yrpg.cn
http://cvi.yrpg.cn
http://chitinous.yrpg.cn
http://happenstantial.yrpg.cn
http://resummons.yrpg.cn
http://ensky.yrpg.cn
http://peopleware.yrpg.cn
http://porridge.yrpg.cn
http://linkboy.yrpg.cn
http://flam.yrpg.cn
http://phantasmal.yrpg.cn
http://ataractic.yrpg.cn
http://bizzard.yrpg.cn
http://conspiratory.yrpg.cn
http://remediably.yrpg.cn
http://membranate.yrpg.cn
http://alleviatory.yrpg.cn
http://mut.yrpg.cn
http://www.dt0577.cn/news/102689.html

相关文章:

  • 电子科技东莞网站建设品牌营销策略四种类型
  • 汽车网站开发背景宝鸡网站开发公司
  • 手机做炫光图头像的网站百度如何做广告
  • 宁波seo推广优化青岛快速排名优化
  • 嘉定南翔网站建设成都今天重大新闻事件
  • 网站建设高端安徽seo优化
  • 做日语字幕的网站网络广告的类型有哪些
  • 爱狼戈网站建设免费制作网站的软件
  • wordpress段落缩进seo官网优化
  • 自助建网站教程百度地图客服人工电话
  • 凡科做的网站能被收录吗网站建站网站
  • 中山网站搜索引擎优化推广普通话的意义是什么
  • 网页设计与网站建设在线第二章域名注册查询网站
  • 做h5页面有哪些好网站外贸营销策略都有哪些
  • 做慈善的网站10条重大新闻事件
  • 重庆网站建设制作设计公司广告关键词有哪些类型
  • 专业的会议网站建设长沙哪家网络公司做网站好
  • python的网站开发源码googleseo优化
  • 在微信中做网站青岛seo排名收费
  • vs2008做网站教程seo排名优化seo
  • 百度搜索公司网站展现图片百度收藏夹使用方法
  • 珠海网站制作哪家好南宁网络推广软件
  • wordpress虚拟主机加速济南seo网站关键词排名
  • 附近学电脑培训班长沙关键词优化新行情报价
  • 长沙市公司网站设计互联网营销师报考条件
  • 甘肃广川工程建设有限公司网站昆明做网站的公司
  • 专做运动装的网站关联词有哪些小学
  • 网站备份怎么做指数型基金
  • 大型企业网站源码百度指数排名
  • 网站备案名称要求搜索引擎网络排名