|字段名称|字段类型|中文说明|注释|是否为主键| |---|---|---|---|---| |year_month|varchar(7) NOT NULL|账期,格式 YYYY-MM|账期,格式 YYYY-MM|是| |data_type|integer NOT NULL|数据来源类型|数据来源类型|是| |building_id|varchar(64) NOT NULL|楼宇 ID|楼宇 ID|是| |regionid|varchar(64) NOT NULL|栅格区域 ID|栅格区域 ID|是| |x_offset_20|varchar(32) NOT NULL|栅格 X 偏移|栅格 X 偏移|是| |y_offset_20|varchar(32) NOT NULL|栅格 Y 偏移|栅格 Y 偏移|是| |operator_name|varchar(32) NOT NULL|运营商名称|运营商名称|是| |network_class|varchar(32) NOT NULL|网络制式|网络制式|是| |freq|varchar(32) NOT NULL DEFAULT 'all'|频段|频段|是| |indoor_flag|smallint NOT NULL DEFAULT -1|室内外标识|室内外标识|是| |building_name|varchar(128)|楼宇名称(冗余)|楼宇名称(冗余)|否| |provincecode|integer NOT NULL|省编码|省编码|否| |citycode|integer NOT NULL|地市编码|地市编码|否| |districtcode|integer NOT NULL|区县编码|区县编码|否| |grid_wkt|text|栅格 WKT,EPSG:4326|栅格 WKT,EPSG:4326|否| |grid_geom|geometry(Polygon, 4326)|由 grid_wkt 生成的 Polygon 几何列|由 grid_wkt 生成的 Polygon 几何列|否| |updated_time|timestamp without time zone NOT NULL DEFAULT now()|记录更新时间|记录更新时间|否| --- ### 计算逻辑说明 * **实现侧**:PostGIS * **数据源**:`td_grid *` (同步自 Hive) + `td_building #` (维表)。 * **计算逻辑**: 1. **空间快速关联**:使用 `ST_Contains(building.aoi_geom, grid.grid_center_point)`。 2. **三级行政区划过滤**:必须强制 `grid` 与 `building` 的 `provincecode`, `citycode`, `districtcode` 完全一致,以提升空间索引效率。 3. **输出**:生成楼宇与活跃栅格的映射关系,结果同步回 Hive 侧。 * **字段全量映射清单**: | 目标字段 | 来源表 & 字段 | 转换逻辑/备注 | | :--- | :--- | :--- | | `year_month` | ODS: `year_month` | 直接映射 | | `data_type` | ODS: `data_type` | 直接映射 | | `building_id` | `td_building #`: `building_id` | 关联主键 | | `regionid` | `td_grid *`: `regionid` | 关联主键 | | `x_offset_20` | `td_grid *`: `x_offset_20` | 冗余映射 | | `y_offset_20` | `td_grid *`: `y_offset_20` | 冗余映射 | | `operator_name` | ODS: `operator_name` | 直接映射 | | `network_class` | ODS: `network_class` | 直接映射 | | `freq` | ODS: `freq` | 直接映射 | | `indoor_flag` | ODS: `indoor_flag` | 继承属性 (统一为 0:室外, 1:室内) | | `building_name` | `td_building #`: `building_name` | 冗余回填 | | `provincecode` | `td_building #`: `provincecode` | 归属回填 | | `citycode` | `td_building #`: `citycode` | 归属回填 | | `districtcode` | `td_building #`: `districtcode` | 归属回填 | | `grid_wkt` | `td_grid *`: `grid_wkt` | 冗余回填 | | `grid_geom` | `td_grid *`: `grid_geom` | 冗余回填 | | `updated_time` | - | 系统当前时间 `now()` |