File size: 1,631 Bytes
e8c001c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
id: offline-compute_HiveSQL_hivesql_028
name: From input table internal_platform_db.t_eis_feedaggregator2_feedforredd
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
Task Objective: Extract qualifying records from the input table, parse the JSON array, and explode it into multiple rows, then output to the target table.

Input:
- `internal_platform_db.t_eis_feedaggregator2_feedforreddot_check_result_summary_classification_df_query_engine_152`

Processing Rules:
1. Filter condition: `ds='20260608'`, `regexp_replace(second_update_date, '-', '') = ds`, `second_status in (1, 2)`
2. Core transformation:
   - Extract `$.info.titles` from the `json_buffer_` field as a JSON array string
   - Remove the outermost square brackets of the array, replace `},{` with `}|{`, and split by `|` to obtain multiple JSON objects
   - Use `LATERAL VIEW explode` to expand into multiple rows, with one `title_obj` per row
   - Extract from each `title_obj`: `$.title`, `$.title_type`, `$.quality`
3. No joins, single-table processing

Output Requirements:
- Output field order: `ds`, `feedid`, `feedid_v1`, `type_source`, `classification`, `title`, `title_type`, `quality`, `second_status`
- The `ds` field value is fixed as `20260608`
- The `feedid_v1` field value equals `feedid`
- No deduplication or aggregation required

Write Requirements:
- Output table: `internal_platform_db.dws_rd_feedaggregator_feed_title_quality_di_cand_query_engine_152`
- Partition field: `ds=20260608`
- Write method: `INSERT OVERWRITE`

Please write the final HiveSQL to `result.sql` and execute it.