You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 赵帅 <zh...@2b13c.com> on 2020/11/10 07:14:33 UTC

flink sql lateral table问题

关于行转列问题,请教一下
SELECT
    alert_id,
    organization_id
FROM  (
    SELECT alert_id, org_ids FROM db_ods_hive.ods_alert_content_in_hive WHERE cd_date = '${date}'
)
LEFT JOIN LATERAL TABLE(ALERT_ORGANIZATION_IDS_TO_ROWS(org_ids, ',')) AS T(organization_id) ON TRUE
WHERE 
    organization_id IS NOT NULL 
AND organization_id &gt; 0
上面select语句没有问题
INSERT INTO db_ods_hive.ods_alert_organization_relation_in_hive PARTITION(cd_date ='${date}')
SELECT
    alert_id,
    organization_id
FROM  (
    SELECT alert_id, org_ids FROM db_ods_hive.ods_alert_content_in_hive WHERE cd_date = '${date}'
)
LEFT JOIN LATERAL TABLE(ALERT_ORGANIZATION_IDS_TO_ROWS(org_ids, ',')) AS T(organization_id) ON TRUE
WHERE 
    organization_id IS NOT NULL 
AND organization_id &gt; 0当添加insert语句后,报org_ids字段找不到