dicemy's picture
Upload 655 files
e8c001c verified
|
Raw
History Blame Contribute Delete
5.23 kB
metadata
id: offline-compute_HiveSQL_hivesql_025
name: 任务:将两个商品数据源(精细采集和泛化采集)合并,对每个字段生成质量评分。输入表:ads_sec_ec_su
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql

Prompt

任务目标:将两个商品数据源(精细采集表 hi 和泛化采集表 extensive)按日期分区过滤后 UNION ALL 合并,对合并后的每条记录的每个字段生成质量评分(0/1),输出到评分结果表。

输入:

  • internal_platform_db.ads_sec_ec_sup_ec_tele_item_hi_query_engine_140(精细采集表,小时分区 p_hour)
  • internal_platform_db.ads_sec_ec_sup_ec_tele_security_platform_lk_extensive_item_query_engine_140(泛化采集表,日分区 p_date)
  • 第三个输入表 internal_platform_db.ads_sec_ec_sup_ec_tele_item_score_query_engine_140 在本任务中不使用

处理规则:

  1. 过滤条件:

    • hi 表:p_hour >= '2026060800' AND p_hour < '2026060900'
    • extensive 表:p_date = '20260608'
  2. UNION ALL 前的字段映射(两表字段不完全一致):

    • hi 表:使用 sale_price,新增 source_type='精细采集'
    • extensive 表:使用 price(映射为 sale_price),新增 source_type='泛化采集'
    • 其他字段直接对齐
  3. is_exp 派生规则(是否交付):

    • 精细采集来源:required_quality_score=1 AND status=1 → 1,否则 0
    • 泛化采集来源:required_quality_score=1 → 1,否则 0
  4. is_off_shelf 派生规则(是否下架):status<>1 → 1,否则 0

  5. 质量评分字段生成规则(所有字段名加 _score 后缀,除 uniqu_id 外):

    • STRING 类型字段(id/name/url/shop_uniqu_id/shop_name/shop_url/platform_name/task_id/batch_id):coalesce(field,'') <> '' → 1,否则 0
    • STRING 类型字段(property/sku_list/desc_info/main_image_url/sub_image_url/category_level1_name/category_level2_name/category_level3_name/shipping_address/price_text/detail_image_url/service_guarantee/brand_name/category_level1_original/category_level2_original/category_level3_original/brand_name_original/product_name/approval_number/ccc_certificate_number/efficacy/production_place/manufacturer/production_license_number/factory_name/factory_address/brand_authorization_image_url/main_image_ocr/sub_image_ocr/detail_image_ocr/industry_id/industry_name):coalesce(field,'') = '' → 0,否则 1
    • 非空判断字段(status/sale_price/sale_qty/stock_qty/category_level1_id/category_level2_id/category_level3_id/shop_id/platform_id/brand_id/comments_cnt/high_remark_cnt/med_remark_cnt/bad_remark_cnt/sku_cnt/license_collection_status/screenshot_url):field IS NOT NULL → 1,否则 0
    • 特殊字段:
      • logo_brand_score、similarity_img_url_score、data_method_keyword_score、task_name_score:固定 NULL
      • required_quality_score、core_quality_score、other_quality_score、platform_name、source_type、is_exp、is_off_shelf:直接传递,不生成评分

输出要求:

  • 输出字段顺序(共 89 字段):p_date、uniqu_id、id_score、name_score、sub_title_score、property_score、sku_list_score、desc_info_score、url_score、status_score、price_score、sale_qty_score、stock_qty_score、main_image_url_score、sub_image_url_score、category_level1_id_score、category_level1_name_score、category_level2_id_score、category_level2_name_score、category_level3_id_score、category_level3_name_score、shop_uniqu_id_score、shop_id_score、shop_name_score、shop_url_score、platform_id_score、platform_name_score、shipping_address_score、price_text_score、flag_score、need_cutpic_score、is_ocr_score、soe_flag_score、data_channel_score、data_method_score、data_source_score、detail_image_url_score、service_guarantee_score、brand_id_score、brand_name_score、is_ad_score、is_selfoperated_score、create_time_score、task_id_score、batch_id_score、category_level1_original_score、category_level2_original_score、category_level3_original_score、brand_name_original_score、product_name_score、approval_number_score、ccc_certificate_number_score、efficacy_score、production_place_score、manufacturer_score、production_license_number_score、factory_name_score、factory_address_score、brand_authorization_image_url_score、is_virtual_score、is_invoice_score、is_guarantee_score、is_free_ship_score、comments_cnt_score、industry_id_score、industry_name_score、high_remark_cnt_score、med_remark_cnt_score、bad_remark_cnt_score、main_image_ocr_score、sub_image_ocr_score、detail_image_ocr_score、ml_category_tag_score、logo_brand_score、similarity_img_url_score、sku_cnt_score、license_collection_status_score、data_method_keyword_score、task_name_score、screenshot_url_score、required_quality_score、core_quality_score、other_quality_score、platform_name、source_type、is_exp、is_off_shelf

写入要求:

  • 输出表:internal_platform_db.ads_sec_ec_sup_ec_tele_item_score_cand_query_engine_140
  • 写入方式:INSERT OVERWRITE,覆盖分区 p_date='20260608'
  • 分区字段:p_date='20260608'(硬编码,非从源表继承)

请将最终 HiveSQL 写入 result.sql 并执行。