当前位置:网站首页>违法行为分析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)
边栏推荐
- Guessing game (read data from file)
- The 19th Zhejiang Provincial Collegiate Programming Contest 2022浙江省赛 F.EasyFix 主席树
- Add data analysis tools in Excel
- Software test classification
- 十四、数据库的导出和导入的两种方法
- Network security - information query of operating system
- Network security -burpsuit
- 定位到最底部[通俗易懂]
- 网络安全-burpsuit
- Solution: prompt "unsupported video format" when inserting avi format video into the message
猜你喜欢
LeeCode -- 6. Z 字形变换
Introduction to redis and jedis and redis things
微信论坛交流小程序系统毕业设计毕设(4)开题报告
Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night
When copying something from the USB flash disk, an error volume error is reported. Please run CHKDSK
二叉树(Binary Tree)
Installing spss25
在软件工程领域,搞科研的这十年!
微信论坛交流小程序系统毕业设计毕设(1)开发概要
微信论坛交流小程序系统毕业设计毕设(5)任务书
随机推荐
Transform XL translation
[untitled] reprint melting ice - track icedid server with a few simple steps
Add data analysis tools in Excel
CAIP2021 初赛VP
UE4_UE5结合罗技手柄(F710)使用记录
Locate to the bottom [easy to understand]
Specific method example of V20 frequency converter manual automatic switching (local remote switching)
网络安全-联合查询注入
Innovation today | five key elements for enterprises to promote innovation
Inftnews | web5 vs Web3: the future is a process, not a destination
PMP project management exam pass Formula-1
微信论坛交流小程序系统毕业设计毕设(4)开题报告
Brush question 4
2021-01-12
The 19th Zhejiang Provincial Collegiate Programming Contest 2022浙江省赛 F.EasyFix 主席树
re1攻防世界逆向
leetcode-520. 检测大写字母-js
Dynamics 365 find field filtering
opencv scalar传入三个参数只能显示黑白灰问题解决
js 获取对象的key和value