问题1:
在使用 Cube 或者 RollUP的时候,如果分组条件>=5个的时候,会出现一个特殊的问题
当分组条件个数<=4的时候:(可以正常运行且没有错误)
SELECT
nvl (wm,'ALL'),
nvl (product_id, 'ALL'),
nvl (
count(
distinct(
IF (
event_id IN ('BS00A003', 'BW00H010'),
product_id,
null
)
)
),
0
) share_commodity_num--商品被分享次数
FROM
gds.xx
WHERE
dt >= '${hivevar:sdate}'
AND dt <= '${hivevar:edate}'
AND length(shop_id) > 1
AND wm is not null
AND wm !='-'
AND category_id_1 is not null and category_id_1 !='-'
AND category_id_2 is not null and category_id_2 !='-'
AND category_id_3 is not null and category_id_3 !='-'
AND category_id_4 is not null and category_id_4 !='-'
GROUP BY
wm,
category_id_1,
category_id_2,
product_id with cube;
当分组条件个数>=5的