File size: 1,423 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
37
38
39
---
id: offline-compute_HiveSQL_hivesql_021
name: Filter Chinese add-friend content from log table and write to hourly cluster table
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
### Task Objective
Filter Chinese content from the add-friend log table for the specified hour, deduplicate, and write to the hourly cluster table.

### Input
- `internal_platform_db.log_17047_query_engine_131`

### Processing Rules
1. No joins, single-table processing
2. Filter conditions:
   - `day_ = '2026-06-09 00:00:00'` AND `hour_ = '2026-06-09 14:00:00'`
   - `commfrinum_ = 0`
   - `appname_ IN ('app_hello_txt', 'app_add_contact', '')`
   - `length(content_) >= 6`
   - `scene_ IN (1, 3, 10, 13, 15)`
   - `content_` contains Chinese characters (`rlike '.*[一-龥]+.*'`)
   - Number of Chinese characters > 3 (`length(regexp_replace(content_,'[^一-龥]','')) > 3`)
   - Exclude records where `content_ = concat('我是', nickname_)` AND `nicknameupdatetime_ + 86400 * 30 < timestamp_`
3. Deduplication: `SELECT DISTINCT content_`
4. Limit: `LIMIT 1600000`

### Output Requirements
- Output field: `content_` (STRING)

### Write Requirements
- Target table: `internal_platform_db.data_team_member14_addcontent_cluster_hour_cand_query_engine_131`
- Write method: `INSERT INTO`
- Partition: `ds = '2026060914'`

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