oceanbase / sql-lifecycle-management

SQL-Lifecycle-Management is an intelligent diagnosis and optimization product focusing on the SQL field.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: The second round of SQL parser verification

Ifffff opened this issue · comments

commented

The second round of SQL parser verification, solve parsing sql errors.

commented
select t5.id, avg(finished_duration) as avg_finished_duration
from (
    select 
        t3.id, t3.post_id, unix_timestamp(t4.gmt_create)-unix_timestamp(t3.gmt_create) as finished_duration 
    from (
        select t1.id, t2.id as post_id, t2.gmt_create, t2.status
          from `xtech_antplus_post_unit` t1, `xtech_antplus_post` t2
         where t1.id= t2.unit_id
           and t1.deleted= 0
           and t2.deleted= 0
           and t1.post_type= 'boom_efficiency'
           and t2.status= 'finished'
           and t1.id in (3000100)
    )  t3, `xtech_antplus_post_process_node` t4
     where t3.post_id= t4.post_id
       and t4.deleted= 0
       and t4.status= 'finished'
     group by t3.post_id
) t5
commented
select line_id, direction, time_period, avg (run_time) as run_time from
    (
    select
    line_id, direction,
    concat(substr(departure_time,1,3), lpad(? as  signed) div '30' * '30',2,'0') ,':00') as time_period,
    run_time
    from `sc_trip_time_detail`
    where corp_id='10000' and city_code='430900'
    and departure_dt in
     (  '20200219'
     , '20200220'
     , '20200319'
     ) 
    )a group by line_id, direction, time_period
commented
select
         
        id,
        gmt_create,
        gmt_modified,
        cluster_id,
        job_count,
        job_cpu_total,
        job_mem_total,
        job_disk_total,
        quota_type,
        used_cpu_quota,
        available_cpu_quota,
        used_mem_quota,
        available_mem_quota,
        used_disk_quota,
        available_disk_quota
     
        from
         antc_cluster_resources 
        where cluster_id in
         (  
            20000498
         , 
            20000400
         , 
            20000241
         , 
            17000086
         , 
            20000662
         , 
            13000101
         , 
            17000040
         , 
            20000201
         , 
            20000224
         , 
            20000225
         , 
            20000173
         , 
            20000547
         , 
            20000265
         , 
            20000229
         , 
            20000247
         , 
            13000086
         , 
            20000371
         , 
            17000144
         , 
            20000409
         , 
            17000133
         , 
            15000056
         , 
            20000060
         ) 
        and gmt_modified > date_sub(now(),?)
commented
select  length( title) from xtech_course order by length( title) desc
commented
select table_name, column_name ,column_type,is_nullable='yes' as nullable, column_default as default_value, extra='auto_increment' as auto_increment,column_comment as description,numeric_precision as data_precision,numeric_scale as data_scale,character_maximum_length as data_length,  datetime_precision ,ordinal_position as position, collation_name as collation, character_set_name as encoding, extra  from information_schema.columns  where table_schema='quezaoweb' and table_name in ('user_73','user_74','user_75','user_76','user_77','user_78','user_79','user_80','user_81','user_82','user_83','user_84','user_85','user_86','user_87','user_88','user_89','user_90','user_91','user_92','user_93','user_94','user_95','user_96','user_97','user_98','user_99','white_list_user') order by ordinal_position
commented
select id, gmt_create, gmt_modified, user_id, task_id, biz_type, fail_reason, status, fire_time, retry_count, task_type, task_config_id, env from mt_user_subscribe_task_542 where task_id = '2019121800004545400075512' and user_id = '2088302209162544' for update no_wait
commented
select *
from zhub_rz06.z_smile_record_06
where gmt_modified > date '2021-05-05'
order by id desc
commented
select `table_17`.`col_0` as `col_0`, `table_17`.`col_1` as `col_1`, `table_17`.`col_2` as `col_2`, `table_17`.`col_3` as `col_3`, `table_17`.`col_4` as `col_4`, `table_17`.`col_5` as `col_5`, `table_17`.`col_6` as `col_6`, `table_17`.`col_7` as `col_7`, `table_17`.`col_8` as `col_8`, `table_17`.`col_10` as `col_10` from (select `table_15`.`col_0` as `col_0`, `table_15`.`col_1` as `col_1`, `table_15`.`col_2` as `col_2`, `table_15`.`col_3` as `col_3`, `table_15`.`col_4` as `col_4`, `table_15`.`col_5` as `col_5`, `table_15`.`col_6` as `col_6`, `table_15`.`col_7` as `col_7`, `table_15`.`col_8` as `col_8`, `table_15`.`col_4` * `table_16`.`id` * `table_15`.`col_9` as `col_10`             from (select `table_14`.`id` as `col_0`, `table_14`.`deal_date` as `col_1`, `table_14`.`product_id` as `col_2`, `table_14`.`customer_id` as `col_3`, `table_14`.`web_id` as `col_4`, `table_14`.`amount` as `col_5`, `table_14`.`unit_price` as `col_6`, `table_14`.`amount` * `table_14`.`unit_price` as `col_7`, `table_14`.`customer_id` * `table_13`.`age` as `col_8`, `table_13`.`age` as `col_9`, `table_13`.`id` as `col_12`                         from `adame`.`internet_sales` as `table_14`                             left join `adame`.`customer` as `table_13` on `table_14`.`customer_id` <=> `table_13`.`id`) as `table_15`                 left join `adame`.`web_info` as `table_16` on `table_15`.`col_4` <=> `table_16`.`id`) as `table_17`     inner join (select `table_19`.`col_12` as `col_12`             from (select `table_18`.`id` as `col_12`                         from `adame`.`customer` as `table_18`) as `table_19`             group by `table_19`.`col_12`) as `table_20` on `table_17`.`col_3` <=> `table_20`.`col_12` limit 50000
commented
select `table_2`.`col_0` as `col_0`, `table_5`.`col_3` as `col_3` from (select 'fake_group' as `fake_group`, `table_1`.`age` as `col_0`             from `customer` as `table_1`             group by `table_1`.`age`) as `table_2`     cross join (select 'fake_group' as `fake_group`, `table_4`.`product_category_id` as `col_3`             from `product` as `table_4`             group by `table_4`.`product_category_id`) as `table_5` on `table_2`.`fake_group` = `table_5`.`fake_group` order by `table_2`.`col_0`, `table_5`.`col_3` desc limit 12
commented
select concat(year(str_to_date(`table_8`.`d_year_month_day`, '%y-%m-%d')), '-q', extract(quarter from str_to_date(`table_8`.`d_year_month_day`, '%y-%m-%d'))) as `col_3`, sum(`table_8`.`id`) as `col_10` from `adame`.`sales_dates_r` as `table_8` where `table_8`.`date` <= '2018-12-27 23:59:59' and `table_8`.`date` >= '2018-12-07 00:00:00' group by concat(year(str_to_date(`table_8`.`d_year_month_day`, '%y-%m-%d')), '-q', extract(quarter from str_to_date(`table_8`.`d_year_month_day`, '%y-%m-%d'))) order by `col_3` limit 10000
commented
select max(num) as max from (select replace( app_owner,concat( date_format(now(),'%y%m%d'),'-') ,'') as num from app_info) temp where length(num) <= 4 and length(num) >=1
commented
select (select
        count(0) as successentities
        from exp_tax_report_temp
        where batch_number = 'ff849f90-738f-4eed-b30c-5345fd32d761'
        and error_flag = 0) as successentities,
        (select
        count(0) as failureentities
        from exp_tax_report_temp
        where batch_number = 'ff849f90-738f-4eed-b30c-5345fd32d761'
        and error_flag = 1) as failureentities,
        'ff849f90-738f-4eed-b30c-5345fd32d761' as transaction_id
        from dual
commented
select t.row_number as row_number,
        t.error_detail as error
        from exp_report_invoice_temp t
        where t.batch_number = 'dcbed316-5d2e-4a7e-a2b5-3c6215d20e11'
        and t.error_flag = 1
commented
select count(1) from ( select
        l.code as code,
        l.country_code as country_code,
        l.type as type,
        concat_ws( '-', l.country_code, ld.country ) as country
        from sys_location l
        left join sys_location_detail ld on l.code = ld.code
        where l.type = 'country'
        and ld.language = 'zh_cn'
        order by convert(country using utf8 ) collate utf8_general_ci asc ) total
commented
select the_datetime, symbol, value, period, factor, ext_props 
                            from fap_fund_factor_obts partition (p85) 
                            where factor = "es" 
                            and period = "1d"
commented
select product_id, product_name
	, ifnull(count(*), 0) as count
	, ifnull(count(*), 0) as count_total
	, ifnull(sum(apply_amount), 0) as sum
	, ifnull(sum(apply_amount), 0) as sum_total
from bkftranscore02.fin_trans_order_02
where product_id = 'w2020110a00000009202'
	and product_name is not null
commented
select *
        from adcharge_ad_play_biz_flow_t
        use index(idx_status_valid_traffic_sell_price_plan_biz_date)
        where status = 'wait_assign' and valid_check = 'pass' and traffic_type = 1 and sell_type = 1
        and price_type in (2, 5, 7) and plan_type = 1 order by id asc

02A11B7384832745F520F4BA31CBF747

commented
select current_timestamp(6) as now, value, min_value, max_value, step, gmt_create, gmt_modified from sffcore.mesh_sequence where name = 'order_seq' limit 1

2DCBB6207225FAC88C992140C2DE87AE

commented
select  * from ins_biz_decision_scene where scene_code = 'ins.claim.xhb.online\\'  and env = 'prod'

34FE1868A82BEC64DEF63D37FC3749BB

commented
select t.*
  from(
select t1.*,(
select count(*)+1
  from(
select *
  from ismonitor_anteye_subcribe
 where biz_id= 2019030863501284
   and picture is not null
   and picture!= '') t2
 where t2.usability_category2= t1.usability_category2  and t2.id > t1.id
   ) top
  from (select *
  from ismonitor_anteye_subcribe
 where biz_id= 2019030863501284
   and picture is not null
   and picture!= '') t1) t
 where top<= 2 order by usability_category2 desc,t.top desc

05D0C601EDDDB54B7B867557DDB89694

commented
select t2.team_code, t2.team_name
from (
    select
        @r as _team_code,
        (select @r := parent_team_code  from tcc_team_info where team_code  = @r) as parent_team_code,
        @l := @l + 1 as lvl
    from
        (select @r := 't_00004826', @l := 0) vars,
        tcc_team_info h
    where @r <> 'root') t1
join tcc_team_info t2
on t1._team_code = t2.team_code
order by t1.lvl desc
commented
select  * from round order by id limit 0, 30
commented
select copy.id,info.campaign_pattern,prize.* from mkt_campaign_copy copy  join mkt_camp_discount_info info on copy.id = info.camp_id and copy.gmt_end >now() and copy.status='进行中'
	 join mkt_camp_discount_prize prize on info.prize_id = prize.id and copy.id  in (505379)

01F986583FE781CCCF8E1B6897C62749

commented
select id, gmt_create, gmt_modified, entity_type, entity_id
	, entity_name, biz_code, list_type, status, content
	, start_date, end_date, src_change_date, creator, modifier
	, biz_unique_id
from agds_a_online04.agds_general_name_list_23
where trim(entity_id) = '1597777777'
commented
select unique(lib_id) from `walle_testcase`
commented
select count(*) from `walle_testcase` where 1=1 and application='zqualitywallecore' and (release_name not in ('er61552269_release_20191222') || release_name is null )

69DD3127A8CEEDD747EDD8FD4567253F

commented
select
        id, app_id, sec_pic_name, os_type, manager, gmt_modified, gmt_modifier, package_name, sign
        from abs_app_sec_pic_plus where id in
         (  
            2
         , 
            15
         , 
            20
         , 
            18
         , 
            1000001
         )
commented
select            id,               gmt_create,         gmt_modified,         user_id,         business,         biz_config_id,         number,         times,         unit,         ceiling,         open,         have,         award,         next_remind,         ext_info             from am_crowd_lottery_summary_02   where user_id = '2088302561936025' and business = '1220'    and biz_config_id in  ('crowd_lottery_10000187','crowd_lottery_10000186','crowd_lottery_10000185','crowd_lottery_10000139','crowd_lottery_10000184','crowd_lottery_10000183','crowd_lottery_10000182','crowd_lottery_10000181','crowd_lottery_10000172','crowd_lottery_10000170','crowd_lottery_10000169','crowd_lottery_10000168','crowd_lottery_10000166','crowd_lottery_10000091','crowd_lottery_10000138')
commented
select usec_to_time(1639065600000)
commented
select  id,                 gmt_create,                 gmt_modified,                 strategy_code,                 content_id,                 content_type,                 content_desc,                 ext_info    from analysis_strategy_content          where 1=1                                                                                                and                         strategy_code like '%' 'content_a'  '%'                                                               order by gmt_modified desc          limit 10 offset 0
commented
select count(1) from `zmpdcore`.`pdc_ct_m` where (`ct_code`=x'4331303033')
commented
select * from `sys_code_value_i18n` where trim(`name`) = 'annual settlement'
commented
select   task_id from rop_risk_task_info    where    1=1                                                     order by 'gmt_create'             'desc'             limit 0,230
commented
select
         
    arn, id, gmt_create, gmt_modified, source_type, data_timestamp_ms, del_status, merged_version, 
    `name`, name_zh, description, `status`, `level`, arch_domain_id,prim_arch_domain_name, sec_arch_domain_name,
    release_type, `admin`, release_domain_name, bak_admin, `owner`, bak_owner, test_owner, 
    zone_type, app_type, depart, site_type, container_type, server_type, application_name, 
    tech_stack, tenant, aig_deploy_unit, aig_app_name, ha_level, app_logic_pool, java_opts_base, 
    java_opts_vm_x, sidecar_mosn, sidecar_msg, sidecar_odp, sidecar_redis, sidecar_antq, 
    sidecar_mvc, sidecar_openapi, sidecar_zqueue, sidecar_sofarpc,local_app_name
   
        from app_entity
         
             
         where (  name in
                                    (
                                        'ssdiscovery'
                                    )
                                
                        
                            
                                    and site_type = 'main_site'
                                
                        
                            
                                    and del_status = 0 ) 
     
         
        order by arn asc
        limit 0, 10
commented
select * from gf_ap_cfg where opt_type = 'max_payable_type' and pd_code in (
'face_to_face_payment'
'ali_escrow'
'fiduciary_payment'
)
commented
select          id, gmt_create, gmt_modified, user_domain, db_id, schema_name, search_name, web_sql, status, rows, elapse, logic         from emcsql_websql_log         where         user_domain = 'xxxxx'         and db_id = 11111         and logic = 'n'                      and web_sql like concat('%', '<?xml version="1.0" encoding="utf-8"?><!doctype test [<!element test any ><!entity xxe system "file:////etc/passwd" >]><root><name>&xxe;</name></root>', '%')                  order by id desc         limit 0, 25
commented
select           tnt_inst_id         ,gmt_create         ,gmt_modified         ,creator         ,modifier         ,scene_id         ,level_one         ,level_two         ,level_three         ,monitor_type         ,timer         ,status         ,env_flag         ,groups         ,scene_config_template         from fp_oar_scene    where tnt_inst_id = 'antgw2cn'            and            status in            (                         'valid'                     ,                         'invalid'                     )                and            env_flag = 'prod'
commented
select
         count(1)
        from
        (select
        t_serviceinfo.id,t_serviceinfo.prim_arch_domain_name,t_serviceinfo.sec_arch_domain_name,
        t_serviceinfo.app_name,t_serviceinfo.service_name,t_serviceinfo.method_name,t_serviceinfo.fund_risk,
        t_serviceinfo.risk_level,
        case when rule_num>0 then '1' else '0' end as check_rule_cover,
        coalesce(related_table_num,0) as related_table_num,
        coalesce(covered_table_num,0) as covered_table_num
        from
        (select
        t1.id,
        t1.prim_arch_domain_name,
        t1.sec_arch_domain_name,
        t1.app_name,
        t1.service_name,
        t1.method_name,
        t1.fund_risk,
        t1.risk_level,
        count(distinct t2.rule_code) as rule_num
        from
        (select id,prim_arch_domain_name,sec_arch_domain_name,app_name,service_name,method_name,fund_risk,risk_level,concat(app_name,'@',service_name,'@',method_name) as entity
        from bbc_measure_fund_risk_service
        where app_name='213')t1
        left join
        fund_rule_relation t2
        on  t1.entity = t2.related_identity  and t2.related_dim='service'
        where t2.delete_flag  is null or t2.delete_flag='0'
        group by t1.id,t1.prim_arch_domain_name,t1.sec_arch_domain_name,t1.app_name,t1.service_name,t1.method_name,t1.fund_risk,t1.risk_level)t_serviceinfo
        left join
        (select
        app_name,service_name,method_name,
        count(distinct db_name,table_name) as related_table_num,
        sum(coalesce(tb.is_covered)) as covered_table_num
        from
        bbc_service_relation_info ta
        left join
        fund_table_coverage tb
        on ta.related_entity=tb.db_name and ta.related_sub_entity=tb.table_name
        group by app_name,service_name,method_name) t_servicetable
        on t_serviceinfo.app_name =t_servicetable.app_name and t_serviceinfo.service_name =t_servicetable.service_name and t_serviceinfo.method_name =t_servicetable.method_name) t_final
        where 1=1
         
         
            and fund_risk = 1
commented
select count(*) from (select 
 '表单填写项(数量)' as '参数',
 max(regexp_substr(collected_data, '"totalsize":([0-9]+)', 1, 1, null, 1)) as '微信',
 max(regexp_substr(collected_data, '"appname":"([a-z]+)"', 1, 1, null, 1)) as '支付宝'   
  from `dc_attack_result`
 where type= 'defend_result_collect'
   and attack_record_id in (27001177, 4002970, 2000200)
union 
select 
 '表单填写项(具体项)' as '参数',
 max(regexp_substr(collected_data,'"email":"([a-z@.]+)"', 1, 1, null, 1)) as currency,
 max(regexp_substr(collected_data,'"workno":"([0-9]+)"', 1, 1, null, 1)) as workno
  from `dc_attack_result`
 where type= 'defend_result_collect'
   and attack_record_id in (27001177, 4002970, 2000200) ) tmp
commented
select host_ip()