当前位置:网站首页>违法行为分析1
违法行为分析1
2022-07-07 21:51:00 【小胖超凶哦!】
spark-sql> select tt1.tjrq
> ,tt1.dr_sgs
> ,tt1.jn_sgs
> ,tt1.qntq_sgs
>
> ,tt1.dr_swsgs
> ,tt1.jn_swsgs
> ,tt1.qntq_swsgs
>
> ,tt1.dr_swrs
> ,tt1.jn_swrs
> ,tt1.qntq_swrs
>
> ,NVL(round((abs(tt1.dr_sgs-tt1.qntq_sgs)/NVL(tt1.qntq_sgs,1))*100,2),0) as tb_sgs
> ,if(tt1.dr_sgs-tt1.qntq_sgs>0,"上升",'下降') as tb_sgs_bj
>
> ,NVL(round((abs(tt1.dr_swsgs-tt1.qntq_swsgs)/NVL(tt1.qntq_swsgs,1))*100,2),0) as tb_swsgs
> ,if(tt1.dr_swsgs-tt1.qntq_swsgs>0,"上升",'下降') as tb_swsgs_bj
>
> ,NVL(round((abs(tt1.dr_swrs-tt1.qntq_swrs)/NVL(tt1.qntq_swrs,1))*100,2),0) as tb_swrs
> ,if(tt1.dr_swrs-tt1.qntq_swrs>0,"上升",'下降') as tb_swrs_bj
> from(
> select t1.tjrq
> ,t1.dr_sgs
> ,t1.dr_swsgs
> ,t1.dr_swrs
>
> ,sum(t1.dr_sgs)over (partition by substr(t1.tjrq,1,4))as jn_sgs
> ,lag(t1.dr_sgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_sgs
>
> ,sum(t1.dr_swsgs)over (partition by substr(t1.tjrq,1,4))as jn_swsgs
> ,lag(t1.dr_swsgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swsgs
>
> ,sum(t1.dr_swrs)over (partition by substr(t1.tjrq,1,4))as jn_swrs
> ,lag(t1.dr_swrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swrs
> from(
> select substr(sgfssj,1,10)as tjrq
> ,count(1)as dr_sgs --当日事故数
> ,sum(if(swrs7>0,1,0))as dr_swsgs --当日发生死亡事故数
> ,sum(swrs7)as dr_swrs --当日死亡人数
> from dwd.base_acd_file
> group by substr(sgfssj,1,10)
> )t1
> )tt1
> order by tt1.tjrq;
Time taken: 6.484 seconds, Fetched 4966 row(s)
22/07/05 15:46:19 INFO thriftserver.SparkSQLCLIDriver: Time taken: 6.484 seconds, Fetched 4966 row(s)
spark-sql> select tt1.tjrq
> ,tt1.dr_sgs
> ,tt1.jn_sgs
> ,tt1.qntq_sgs
>
> ,tt1.dr_swsgs
> ,tt1.jn_swsgs
> ,tt1.qntq_swsgs
>
> ,tt1.dr_swrs
> ,tt1.jn_swrs
> ,tt1.qntq_swrs
>
> ,tt1.dr_ssrs
> ,tt1.jn_ssrs
> ,tt1.qntq_ssrs
>
> ,tt1.dr_zjccss
> ,tt1.jn_zjccss
> ,tt1.qntq_zjccss
>
> ,NVL(round((abs(tt1.dr_sgs-tt1.qntq_sgs)/NVL(tt1.qntq_sgs,1))*100,2),0) as tb_sgs
> ,if(tt1.dr_sgs-tt1.qntq_sgs>0,"上升",'下降') as tb_sgs_bj
>
> ,NVL(round((abs(tt1.dr_swsgs-tt1.qntq_swsgs)/NVL(tt1.qntq_swsgs,1))*100,2),0) as tb_swsgs
> ,if(tt1.dr_swsgs-tt1.qntq_swsgs>0,"上升",'下降') as tb_swsgs_bj
>
> ,NVL(round((abs(tt1.dr_swrs-tt1.qntq_swrs)/NVL(tt1.qntq_swrs,1))*100,2),0) as tb_swrs
> ,if(tt1.dr_swrs-tt1.qntq_swrs>0,"上升",'下降') as tb_swrs_bj
>
> ,NVL(round((abs(tt1.dr_ssrs-tt1.qntq_ssrs)/NVL(tt1.qntq_ssrs,1))*100,2),0) as tb_ssrs
> ,if(tt1.dr_ssrs-tt1.qntq_ssrs>0,"上升",'下降') as tb_ssrs_bj
>
> ,NVL(round((abs(tt1.dr_zjccss-tt1.qntq_zjccss)/NVL(tt1.qntq_zjccss,1))*100,2),0) as tb_zjccss
> ,if(tt1.dr_zjccss-tt1.qntq_zjccss>0,"上升",'下降') as tb_zjccss_bj
> from(
> select t1.tjrq
> ,t1.dr_sgs
> ,t1.dr_swsgs
> ,t1.dr_swrs
> ,t1.dr_ssrs
> ,t1.dr_zjccss
>
> ,sum(t1.dr_sgs)over (partition by substr(t1.tjrq,1,4))as jn_sgs
> ,lag(t1.dr_sgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_sgs
>
> ,sum(t1.dr_swsgs)over (partition by substr(t1.tjrq,1,4))as jn_swsgs
> ,lag(t1.dr_swsgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swsgs
>
> ,sum(t1.dr_swrs)over (partition by substr(t1.tjrq,1,4))as jn_swrs
> ,lag(t1.dr_swrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swrs
>
> ,sum(t1.dr_ssrs)over (partition by substr(t1.tjrq,1,4))as jn_ssrs
> ,lag(t1.dr_ssrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_ssrs
>
> ,sum(t1.dr_zjccss)over (partition by substr(t1.tjrq,1,4))as jn_zjccss
> ,lag(t1.dr_zjccss,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_zjccss
> from(
> select substr(sgfssj,1,10)as tjrq
> ,count(1)as dr_sgs --当日事故数
> ,sum(if(swrs7>0,1,0))as dr_swsgs --当日发生死亡事故数
> ,sum(swrs7)as dr_swrs --当日死亡人数
> ,sum(ssrs7)as dr_ssrs --当日受伤人数
> ,sum(zjccss)as dr_zjccss --当日直接财产损失
> from dwd.base_acd_file
> group by substr(sgfssj,1,10)
> )t1
> )tt1
> order by tt1.tjrq;
Time taken: 11.104 seconds, Fetched 4966 row(s)
22/07/05 15:56:13 INFO thriftserver.SparkSQLCLIDriver: Time taken: 11.104 seconds, Fetched 4966 row(s)
spark-sql> select tt1.tjrq
>
> ,tt1.dr_sgs
> ,tt1.jn_sgs
> ,tt1.qntq_sgs
> ,NVL(round((abs(tt1.dr_sgs-tt1.qntq_sgs)/NVL(tt1.qntq_sgs,1))*100,2),0) as tb_sgs
> ,if(tt1.dr_sgs-tt1.qntq_sgs>0,"上升",'下降') as tb_sgs_bj
>
> ,tt1.dr_swsgs
> ,tt1.jn_swsgs
> ,tt1.qntq_swsgs
> ,NVL(round((abs(tt1.dr_swsgs-tt1.qntq_swsgs)/NVL(tt1.qntq_swsgs,1))*100,2),0) as tb_swsgs
> ,if(tt1.dr_swsgs-tt1.qntq_swsgs>0,"上升",'下降') as tb_swsgs_bj
>
> ,tt1.dr_swrs
> ,tt1.jn_swrs
> ,tt1.qntq_swrs
> ,NVL(round((abs(tt1.dr_swrs-tt1.qntq_swrs)/NVL(tt1.qntq_swrs,1))*100,2),0) as tb_swrs
> ,if(tt1.dr_swrs-tt1.qntq_swrs>0,"上升",'下降') as tb_swrs_bj
>
> ,tt1.dr_ssrs
> ,tt1.jn_ssrs
> ,tt1.qntq_ssrs
> ,NVL(round((abs(tt1.dr_ssrs-tt1.qntq_ssrs)/NVL(tt1.qntq_ssrs,1))*100,2),0) as tb_ssrs
> ,if(tt1.dr_ssrs-tt1.qntq_ssrs>0,"上升",'下降') as tb_ssrs_bj
>
> ,tt1.dr_zjccss
> ,tt1.jn_zjccss
> ,tt1.qntq_zjccss
> ,NVL(round((abs(tt1.dr_zjccss-tt1.qntq_zjccss)/NVL(tt1.qntq_zjccss,1))*100,2),0) as tb_zjccss
> ,if(tt1.dr_zjccss-tt1.qntq_zjccss>0,"上升",'下降') as tb_zjccss_bj
> from(
> select t1.tjrq
>
> ,t1.dr_sgs
> ,sum(t1.dr_sgs)over (partition by substr(t1.tjrq,1,4))as jn_sgs
> ,lag(t1.dr_sgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_sgs
>
> ,t1.dr_swsgs
> ,sum(t1.dr_swsgs)over (partition by substr(t1.tjrq,1,4))as jn_swsgs
> ,lag(t1.dr_swsgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swsgs
>
> ,t1.dr_swrs
> ,sum(t1.dr_swrs)over (partition by substr(t1.tjrq,1,4))as jn_swrs
> ,lag(t1.dr_swrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swrs
>
> ,t1.dr_ssrs
> ,sum(t1.dr_ssrs)over (partition by substr(t1.tjrq,1,4))as jn_ssrs
> ,lag(t1.dr_ssrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_ssrs
>
> ,t1.dr_zjccss
> ,sum(t1.dr_zjccss)over (partition by substr(t1.tjrq,1,4))as jn_zjccss
> ,lag(t1.dr_zjccss,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_zjccss
> from(
> select substr(sgfssj,1,10)as tjrq
> ,count(1)as dr_sgs --当日事故数
> ,sum(if(swrs7>0,1,0))as dr_swsgs --当日发生死亡事故数
> ,sum(swrs7)as dr_swrs --当日死亡人数
> ,sum(ssrs7)as dr_ssrs --当日受伤人数
> ,sum(zjccss)as dr_zjccss --当日直接财产损失
> from dwd.base_acd_file
> group by substr(sgfssj,1,10)
> )t1
> )tt1
> order by tt1.tjrq;
Time taken: 9.019 seconds, Fetched 4966 row(s)
22/07/05 16:06:51 INFO thriftserver.SparkSQLCLIDriver: Time taken: 9.019 seconds, Fetched 4966 row(s)
spark-sql> create database dws;
Time taken: 0.829 seconds
22/07/05 16:08:44 INFO thriftserver.SparkSQLCLIDriver: Time taken: 0.829 seconds
spark-sql> use dws;
Time taken: 0.032 seconds
22/07/05 16:08:50 INFO thriftserver.SparkSQLCLIDriver: Time taken: 0.032 seconds
spark-sql> CREATE TABLE dws.app_acd_mrjq(
> tjrq STRING COMMENT '统计日期',
>
> dr_sgs int COMMENT '当日事故数',
> jn_sgs int COMMENT '今年事故数',
> tb_sgs double COMMENT '同比事故数',
> tb_sgs_bj STRING COMMENT '同比事故数标记',
>
> dr_swsgs int COMMENT '当日死亡事故数',
> jn_swsgs int COMMENT '今年死亡事故数',
> tb_swsgs double COMMENT '同比死亡事故数',
> tb_swsgs_bj STRING COMMENT '同比死亡事故数标记',
>
> dr_swrs int COMMENT '当日死亡人数',
> jn_swrs int COMMENT '今年死亡人数',
> tb_swrs double COMMENT '同比死亡人数',
> tb_swrs_bj STRING COMMENT '同比死亡人数标记',
>
> dr_ssrs int COMMENT '当日受伤人数',
> jn_ssrs int COMMENT '今年受伤人数',
> tb_ssrs double COMMENT '同比受伤人数',
> tb_ssrs_bj STRING COMMENT '同比受伤人数标记',
>
> dr_zjccss int COMMENT '当日财产损失',
> jn_zjccss int COMMENT '今年财产损失',
> tb_zjccss double COMMENT '同比财产损失',
> tb_zjccss_bj STRING COMMENT '同比财产损失标记'
> )
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY '^'
> STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'
> OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
> location '/car/dws/app_acd_mrjq';
Time taken: 0.186 seconds
22/07/05 16:11:50 INFO thriftserver.SparkSQLCLIDriver: Time taken: 0.186 seconds
spark-sql> INSERT overwrite table dws.app_acd_mrjq
> select tt1.tjrq
> ,tt1.dr_sgs
> ,tt1.jn_sgs
> ,NVL(round((abs(tt1.dr_sgs-tt1.qntq_sgs)/NVL(tt1.qntq_sgs,1))*100,2),0) as tb_sgs
> ,if(tt1.dr_sgs-tt1.qntq_sgs>0,"上升",'下降') as tb_sgs_bj
> ,tt1.dr_swsgs
> ,tt1.jn_swsgs
> ,NVL(round((abs(tt1.dr_swsgs-tt1.qntq_swsgs)/NVL(tt1.qntq_swsgs,1))*100,2),0) as tb_swsgs
> ,if(tt1.dr_swsgs-tt1.qntq_swsgs>0,"上升",'下降') as tb_swsgs_bj
> ,tt1.dr_swrs
> ,tt1.jn_swrs
> ,NVL(round((abs(tt1.dr_swrs-tt1.qntq_swrs)/NVL(tt1.qntq_swrs,1))*100,2),0) as tb_swrs
> ,if(tt1.dr_swrs-tt1.qntq_swrs>0,"上升",'下降') as tb_swrs_bj
> ,tt1.dr_ssrs
> ,tt1.jn_ssrs
> ,NVL(round((abs(tt1.dr_ssrs-tt1.qntq_ssrs)/NVL(tt1.qntq_ssrs,1))*100,2),0) as tb_ssrs
> ,if(tt1.dr_ssrs-tt1.qntq_ssrs>0,"上升",'下降') as tb_ssrs_bj
> ,tt1.dr_zjccss
> ,tt1.jn_zjccss
> ,NVL(round((abs(tt1.dr_zjccss-tt1.qntq_zjccss)/NVL(tt1.qntq_zjccss,1))*100,2),0) as tb_zjccss
> ,if(tt1.dr_zjccss-tt1.qntq_zjccss>0,"上升",'下降') as tb_zjccss_bj
> from(
> select t1.tjrq
> ,t1.dr_sgs
> ,sum(t1.dr_sgs)over (partition by substr(t1.tjrq,1,4))as jn_sgs
> ,lag(t1.dr_sgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_sgs
> ,t1.dr_swsgs
> ,sum(t1.dr_swsgs)over (partition by substr(t1.tjrq,1,4))as jn_swsgs
> ,lag(t1.dr_swsgs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swsgs
> ,t1.dr_swrs
> ,sum(t1.dr_swrs)over (partition by substr(t1.tjrq,1,4))as jn_swrs
> ,lag(t1.dr_swrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_swrs
> ,t1.dr_ssrs
> ,sum(t1.dr_ssrs)over (partition by substr(t1.tjrq,1,4))as jn_ssrs
> ,lag(t1.dr_ssrs,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_ssrs
> ,t1.dr_zjccss
> ,sum(t1.dr_zjccss)over (partition by substr(t1.tjrq,1,4))as jn_zjccss
> ,lag(t1.dr_zjccss,1,1)over (partition by substr(t1.tjrq,6,5)order by substr(t1.tjrq,1,4))as qntq_zjccss
> from(
> select substr(sgfssj,1,10)as tjrq
> ,count(1)as dr_sgs --当日事故数
> ,sum(if(swrs7>0,1,0))as dr_swsgs --当日发生死亡事故数
> ,sum(swrs7)as dr_swrs --当日死亡人数
> ,sum(ssrs7)as dr_ssrs --当日受伤人数
> ,sum(zjccss)as dr_zjccss --当日直接财产损失
> from dwd.base_acd_file
> group by substr(sgfssj,1,10)
> )t1
> )tt1;
spark-sql> select * from dws.app_acd_mrjq;
Time taken: 0.271 seconds, Fetched 4966 row(s)
22/07/05 16:23:40 INFO thriftserver.SparkSQLCLIDriver: Time taken: 0.271 seconds, Fetched 4966 row(s)
spark-sql> select substr(fxjg,1,4) as fxjg,wfxw1 as wfxw,jtfs,dllx,xxly,wfdd,wfsj,cjbj,jllx from dwd.base_vio_force union all
> select substr(fxjg,1,4) as fxjg,wfxw2 as wfxw,jtfs,dllx,xxly,wfdd,wfsj,cjbj,jllx from dwd.base_vio_force union all
> select substr(fxjg,1,4) as fxjg,wfxw3 as wfxw,jtfs,dllx,xxly,wfdd,wfsj,cjbj,jllx from dwd.base_vio_force union all
> select substr(fxjg,1,4) as fxjg,wfxw4 as wfxw,jtfs,dllx,xxly,wfdd,wfsj,cjbj,jllx from dwd.base_vio_force union all
> select substr(fxjg,1,4) as fxjg,wfxw5 as wfxw,jtfs,dllx,xxly,wfdd,wfsj,cjbj,jllx from dwd.base_vio_force union all
> select substr(fxjg,1,4) as fxjg,wfxw,jtfs,dllx,xxly,wfdd,wfsj,'1' cjbj,jllx from dwd.base_vio_violation
> ;
Time taken: 4.433 seconds, Fetched 262227 row(s)
22/07/06 16:16:11 INFO thriftserver.SparkSQLCLIDriver: Time taken: 4.433 seconds, Fetched 262227 row(s)
spark-sql> select substr(fxjg,1,4)as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,cjbj
> ,jllx
> from dwd.base_vio_force
> lateral view explode(array(wfxw1,wfxw2,wfxw3,wfxw4,wfxw5))v as wfxw
> union
> select substr(fxjg,1,4) as fxjg,wfxw,jtfs,dllx,xxly,wfdd,wfsj,'1' cjbj,jllx from dwd.base_vio_violation
> ;
Time taken: 3.768 seconds, Fetched 129456 row(s)
22/07/06 16:24:40 INFO thriftserver.SparkSQLCLIDriver: Time taken: 3.768 seconds, Fetched 129456 row(s)
spark-sql> select *
> from(
> select substr(fxjg,1,4)as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,cjbj
> ,jllx
> from dwd.base_vio_force
> lateral view explode(array(wfxw1,wfxw2,wfxw3,wfxw4,wfxw5))v as wfxw
> union
> select substr(fxjg,1,4) as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,'1' cjbj
> ,jllx from dwd.base_vio_violation
> )t1 where t1.fxjg='5306' and t1.wfxw='1083B';
Time taken: 1.654 seconds, Fetched 443 row(s)
22/07/06 16:30:16 INFO thriftserver.SparkSQLCLIDriver: Time taken: 1.654 seconds, Fetched 443 row(s)
spark-sql> select *
> from(
> select substr(fxjg,1,4)as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,cjbj
> ,jllx
> from dwd.base_vio_force
> lateral view explode(array(wfxw1,wfxw2,wfxw3,wfxw4,wfxw5))v as wfxw
> union
> select substr(fxjg,1,4) as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,'1' cjbj
> ,jllx
> from dwd.base_vio_violation
> )t1 where t1.fxjg='5306' and t1.wfxw='1083B'
> order by t1.wfsj
> ;
Time taken: 2.812 seconds, Fetched 443 row(s)
22/07/06 16:33:18 INFO thriftserver.SparkSQLCLIDriver: Time taken: 2.812 seconds, Fetched 443 row(s)
spark-sql> select date_format('2020-10-16 01:36:24','yyyy-MM-dd');
spark-sql> select date_format('2020-10-16 01:36:24','yyyy/MM/dd');
spark-sql> select ttt1.tjrq
> ,ttt1.dr_wfs
> ,ttt1.jn_wfs
> ,ttt1.qntq_wfs
> ,NVL(round((abs(ttt1.dr_wfs-ttt1.qntq_wfs)/NVL(ttt1.qntq_wfs,1))*100,2),0) as tb
> from(
> select tt1.tjrq
> ,tt1.dr_wfs
> ,sum(tt1.dr_wfs)over (partition by year(tt1.tjrq))as jn_wfs
> ,lag(tt1.dr_wfs,1,1)over (partition by date_format(tt1.tjrq,'MM-dd')order by year(tt1.tjrq))as qntq_wfs
> from(
> select date_format(t1.wfsj,'yyyy-MM-dd')as tjrq
> ,count(1)as dr_wfs --当日违法数
> from(
> select substr(fxjg,1,4)as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,cjbj
> ,jllx
> from dwd.base_vio_force
> lateral view explode(array(wfxw1,wfxw2,wfxw3,wfxw4,wfxw5))v as wfxw
> union
> select substr(fxjg,1,4) as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,'1' cjbj
> ,jllx
> from dwd.base_vio_violation
> )t1 where t1.wfxw is not null
> group by date_format(t1.wfsj,'yyyy-MM-dd')
> )tt1
> )ttt1
>
> ;
Time taken: 8.772 seconds, Fetched 1021 row(s)
22/07/06 16:57:47 INFO thriftserver.SparkSQLCLIDriver: Time taken: 8.772 seconds, Fetched 1021 row(s)
spark-sql> select ttt1.tjrq
> ,ttt1.dr_wfs
> ,ttt1.jn_wfs
> ,ttt1.qntq_wfs
> ,NVL(round((abs(ttt1.dr_wfs-ttt1.qntq_wfs)/NVL(ttt1.qntq_wfs,1))*100,2),0) as tb
> ,if(ttt1.dr_wfs>ttt1.qntq_wfs,'上升','下降') as tbbj
> from(
> select tt1.tjrq
> ,tt1.dr_wfs
> ,sum(tt1.dr_wfs)over (partition by year(tt1.tjrq))as jn_wfs
> ,lag(tt1.dr_wfs,1,1)over (partition by date_format(tt1.tjrq,'MM-dd')order by year(tt1.tjrq))as qntq_wfs
> from(
> select date_format(t1.wfsj,'yyyy-MM-dd')as tjrq
> ,count(1)as dr_wfs --当日违法数
> from(
> select substr(fxjg,1,4)as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,cjbj
> ,jllx
> from dwd.base_vio_force
> lateral view explode(array(wfxw1,wfxw2,wfxw3,wfxw4,wfxw5))v as wfxw
> union
> select substr(fxjg,1,4) as fxjg
> ,wfxw
> ,jtfs
> ,dllx
> ,xxly
> ,wfdd
> ,wfsj
> ,'1' cjbj
> ,jllx
> from dwd.base_vio_violation
> )t1 where t1.wfxw is not null
> group by date_format(t1.wfsj,'yyyy-MM-dd')
> )tt1
> )ttt1
> ;
Time taken: 5.995 seconds, Fetched 1021 row(s)
22/07/06 17:01:35 INFO thriftserver.SparkSQLCLIDriver: Time taken: 5.995 seconds, Fetched 1021 row(s)
边栏推荐
- 在软件工程领域,搞科研的这十年!
- 微信论坛交流小程序系统毕业设计毕设(5)任务书
- 2021ICPC上海 H.Life is a Game Kruskal重构树
- What are the similarities and differences between smart communities and smart cities
- ArcGIS: field assignment_ The attribute table field calculator assigns values to fields based on conditions
- re1攻防世界逆向
- 为什么市场需要低代码?
- 智慧社区和智慧城市之间有什么异同
- Handling file exceptions
- PMP project management exam pass Formula-1
猜你喜欢
随机推荐
USB(十四)2022-04-12
Talk about the design and implementation logic of payment process
网络安全-burpsuit
php 使用阿里云存储
Add data analysis tools in Excel
Innovation today | five key elements for enterprises to promote innovation
ArcGIS:字段赋值_属性表字段计算器(Field Calculator)依据条件为字段赋值
PMP项目管理考试过关口诀-1
leetcode-520. 检测大写字母-js
Dynamics 365 find field filtering
iNFTnews | NFT技术的广泛应用及其存在的问题
Are the microorganisms in the intestines the same as those on the skin?
Network security sqlmap and DVWA explosion
十四、数据库的导出和导入的两种方法
Unity3D学习笔记4——创建Mesh高级接口
聊聊支付流程的设计与实现逻辑
Lecture 30 linear algebra Lecture 5 eigenvalues and eigenvectors
Gee (III): calculate the correlation coefficient between two bands and the corresponding p value
网格(Grid)
The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)