当前位置:网站首页>违法行为分析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)
边栏推荐
猜你喜欢
LeeCode -- 6. Z 字形变换
【微服务|SCG】gateway整合sentinel
Installing spss25
微信论坛交流小程序系统毕业设计毕设(3)后台功能
Lecture 30 linear algebra Lecture 5 eigenvalues and eigenvectors
U盘拷贝东西时,报错卷错误,请运行chkdsk
re1攻防世界逆向
微信论坛交流小程序系统毕业设计毕设(8)毕业设计论文模板
Wechat forum exchange applet system graduation design completion (6) opening defense ppt
js 获取对象的key和value
随机推荐
Bea-3xxxxx error code
13、 System optimization
Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
[untitled] reprint melting ice - track icedid server with a few simple steps
Binary tree
Locate to the bottom [easy to understand]
Redhat下安装fedora
Exploratory data analysis of heartbeat signal
Network security - phishing
./ setup. Insufficient sh permission
2021-01-11
ArcGIS: two methods of attribute fusion of the same field of vector elements
Unity3D学习笔记6——GPU实例化(1)
STL标准模板库(Standard Template Library)一周学习总结
力扣解法汇总648-单词替换
Brush question 5
USB (十七)2022-04-15
Install Fedora under RedHat
Statistical method for anomaly detection
Dynamics 365 查找字段过滤