写hql过程中遇到count(distinct)问题,之后通过max(1)解决
代码如下
'''
SELECT
day,
COUNT(1) AS devices_count
FROM
(
SELECT
UPPER(device_id) AS device_id,
dt AS day,
MAX(1)
FROM
ks_device.device_new_extend_active_base_std_dt
WHERE
(dt BETWEEN '{start_day:%Y-%m-%d}' AND '{end_day:%Y-%m-%d}')
GROUP BY
UPPER(device_id),
dt
) AS meow
GROUP BY
day
'''