create table $x00256702.$pr01_temp_p3_ntr_grid_new__1604666481550 as select concat(radio_mcc,Radio_MNC) as plmn,Radio_Brand,Radio_Network_Generation, left(Test_Timestamp,7) as month, cast((180.0 * (cast(floor(cast(Location_Longitude as double) * 20037508.34 / 180.0 / 300) as int) * 300 + 50) / 20037508.34) as decimal(30,10)) as grid_longitude, case when ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() >1 then cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(20037508.34/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) when ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() < -1 then cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(-20037508.34/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) else cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() * 20037508/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) end as grid_latitude, avg(throughput_receive) as download_bps,sum(test_samples) as samples from $public_standard.$ps04_p3_ntr__za where Radio_RXLevel>=-150 and Radio_RXLevel<=-10 and Radio_Network_Generation!='WiFi' and traffic_direction='Downlink' and concat(radio_mcc,Radio_MNC)!='' and concat(radio_mcc,Radio_MNC) in (select a.plmn from (select concat(radio_mcc,Radio_MNC) as plmn,count(0) as num from $public_standard.$ps04_p3_ntr__za where concat(radio_mcc,Radio_MNC)!='' group by concat(radio_mcc,Radio_MNC) order by num desc limit 4)a ) and left(test_timestamp,7) in (left(cast(months_add(now(),0) as string),7), left(cast(months_add(now(),-1) as string),7), left(cast(months_add(now(),-2) as string),7), left(cast(months_add(now(),-3) as string),7), left(cast(months_add(now(),-4) as string),7), left(cast(months_add(now(),-5) as string),7), left(cast(months_add(now(),-6) as string),7)) group by radio_mcc,Radio_MNC,Radio_Brand,Radio_Network_Generation,month,grid_longitude,grid_latitude ;解析一下这个算法脚本
时间: 2024-04-27 12:19:43 浏览: 143
这是一个 SQL 查询语句,具体解析如下:
1. 创建一个名为 `$x00256702.$pr01_temp_p3_ntr_grid_new__1604666481550` 的表格。
2. 在 `$public_standard.$ps04_p3_ntr__za` 表格中,选取以下条件的数据:
- `Radio_RXLevel` 在 -150 到 -10 之间。
- `Radio_Network_Generation` 不等于 "WiFi"。
- `traffic_direction` 等于 "Downlink"。
- `concat(radio_mcc,Radio_MNC)` 不为空。
- `concat(radio_mcc,Radio_MNC)` 在子查询中被选出的前四名 `plmn` 值中。
- `left(test_timestamp,7)` 值在当前月份和前六个月份中。
3. 将选取的数据按照以下条件分组,并计算其中的平均值和总和:
- `concat(radio_mcc,Radio_MNC)`,并将其重命名为 `plmn`。
- `Radio_Brand`。
- `Radio_Network_Generation`。
- `left(Test_Timestamp,7)`,并将其重命名为 `month`。
- `cast((180.0 * (cast(floor(cast(Location_Longitude as double) * 20037508.34 / 180.0 / 300) as int) * 300 + 50) / 20037508.34) as decimal(30,10))`,并将其重命名为 `grid_longitude`。
- `case when ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() >1 then cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(20037508.34/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) when ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() < -1 then cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(-20037508.34/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) else cast((57.295779513082323 * (2.0 * atan(exp((cast(floor(ln(tan((90.0 +cast(Location_Latitude as double)) * pi() / 360.0)) / pi() * 20037508/300) as int)*300 + 50) /20037508.34 * 3.141592653589793)) - 1.570796326794897)) as decimal(30,10)) end`,并将其重命名为 `grid_latitude`。
4. 将分组后的数据插入到 `$x00256702.$pr01_temp_p3_ntr_grid_new__1604666481550` 表格中,其中包括以下列:
- `plmn`。
- `Radio_Brand`。
- `Radio_Network_Generation`。
- `month`。
- `grid_longitude`。
- `grid_latitude`。
- `download_bps`,为 `throughput_receive` 的平均值。
- `samples`,为 `test_samples` 的总和。
阅读全文